For /f command help

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Flyingmetalyak
Posts: 5
Joined: 15 Jan 2010 20:46
Contact:

For /f command help

#1 Post by Flyingmetalyak » 20 Feb 2010 20:16

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.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: For /f command help

#2 Post by aGerman » 20 Feb 2010 21:41

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"

Flyingmetalyak
Posts: 5
Joined: 15 Jan 2010 20:46
Contact:

Re: For /f command help

#3 Post by Flyingmetalyak » 21 Feb 2010 10:56

It works, thanks :D

Post Reply