Page 1 of 1

For /f command help

Posted: 20 Feb 2010 20:16
by Flyingmetalyak
I'm working on this file that makes other files and names them as a users input. Only problem is if the user enters a space and when I try to use a for /f command it says that it can't find the file because of the space. Here is an example of what I'm using

Code: Select all

For /f "delims=" %%a in (%userprofile%\Desktop\whatever.ini) do %%a

I would like to know if there is a way to get around this or if I would just have to get rid of all the spaces in the users input.
Any help would be greatly appreciated, thanks.

Re: For /f command help

Posted: 20 Feb 2010 21:41
by aGerman
One of this 2 lines should work for you:

Code: Select all

for /f "usebackq delims=" %%a in ("%userprofile%\Desktop\whatever.ini") do %%a
for /f "usebackq delims=" %%a in ("%userprofile%\Desktop\whatever.ini") do "%%a"

Re: For /f command help

Posted: 21 Feb 2010 10:56
by Flyingmetalyak
It works, thanks :D