FOR command delims help

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Osmium Programming
Posts: 14
Joined: 16 Oct 2017 20:15

FOR command delims help

#1 Post by Osmium Programming » 23 Jan 2018 01:01

I am trying to set a delimiter to "
I am failing
help

Here's what the guts of it looked like:

Code: Select all

for /f "delims="" %%a in () do ()
I tried to fix it:

Code: Select all

for /f "delims=^"" %%a in () do ()
Same thing

I am positive that the error is my lack in ability to set a delim to "
How do I do this?

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

Re: FOR command delims help

#2 Post by aGerman » 23 Jan 2018 10:37

Try

Code: Select all

for /f delims^=^" %%a in () do ()
Note that you have to escape every space, comma and equal sign if you want to extend the options. E.g.

Code: Select all

for /f tokens^=1^,3^ delims^=^" %%a in ...
Steffen

Osmium Programming
Posts: 14
Joined: 16 Oct 2017 20:15

Re: FOR command delims help

#3 Post by Osmium Programming » 24 Jan 2018 16:42

Thanks so much! I thought of another solution though.

Code: Select all

set input=%input:"=@%
for /f "delims=@" %%a in () do ()
set input=%input:@="%
But that was before I saw your reply, and now I'll use yours because it's a lot simpler.

-Osmium Programming

Post Reply