Page 1 of 1

FOR command delims help

Posted: 23 Jan 2018 01:01
by Osmium Programming
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?

Re: FOR command delims help

Posted: 23 Jan 2018 10:37
by aGerman
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

Re: FOR command delims help

Posted: 24 Jan 2018 16:42
by Osmium Programming
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