How do I include long filenames in the FOR command?

S

Sam Low

Subject says it all. Long file or folder names. " " do not seem to work

Thanks in advance

Sam
 
P

Paul R. Sadowski [MVP]

Hello, Sam:
On Mon, 6 Dec 2004 10:29:02 +0800: you wrote...

SL> Subject says it all. Long file or folder names. " " do not seem to
SL> work

You have to set the tokens to all tokens * as in the example below. For
splits up an item by whitespace so that c:\program files becomes %a =
c:\program and %b = files. Specifying "tokens=*" (note the quotation
marks!) combines all the tokens into one

See for /? for more detail..

for /f "tokens=*" %x in ('dir %windir%\system32\*.dll') do @echo %x

Regards, Paul R. Sadowski [MVP].
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top