Wednesday, May 02, 2007

for DOS command help

http://www.adp-gmbh.ch/blog/2004/november/6.html

http://www.adp-gmbh.ch/blog/2004/november/6.html

FOR

If /F is given to FOR, it is possible to read the output of another program
The following example prints only directories. The tokens=3,4 specifies that I am interested in the third and fourth (by whitespace delimted) tokens. This implicitely also sets the variable %b. If the third token (%a) is equal to then it must be a directory and the fourth token (%b) is its name.
for /f "tokens=3,4" %a in ('dir') do @if "%a" == "" @echo %b

0 Comments:

Post a Comment

<< Home