I want to display all current .txt files
This is wrong because the asterisk in the parentheses after in in for /f seems not to be able to be used as a wildcard. It is okay in for /d and for /r. I don't know if my understanding is correct?
So I adopted the following method
This works, but there is a problem that files like a.txt.mp3 will also be displayed. Is there a better solution?
[ Last edited by tianlijian on 2007-3-18 at 03:18 PM ]
@FOR /F "usebackq delims= tokens=*" %i IN (*.txt) DO @ECHO %i
This is wrong because the asterisk in the parentheses after in in for /f seems not to be able to be used as a wildcard. It is okay in for /d and for /r. I don't know if my understanding is correct?
So I adopted the following method
@FOR /F "usebackq delims= tokens=*" %i IN (`dir ^| find /i ".txt"`) DO @ECHO %i
This works, but there is a problem that files like a.txt.mp3 will also be displayed. Is there a better solution?
[ Last edited by tianlijian on 2007-3-18 at 03:18 PM ]
test


