Solved Thinking about using a variable in a for string

June 5, 2012 at 09:20:48
Specs: Windows XP
I am using windows xp. I was working on the idea of using an entered string through

set /p teststring="please enter the string"

then using

FOR /F "tokens=*" %%G IN (%teststring%) DO echo %%G

I should note that I was really just curious if you could use a variable in place of a string. Thanks for any thoughts, I am sure its something simple, i just can't wrap my head around it.

:: mike


See More: Thinking about using a variable in a for string

Report •


#1
June 5, 2012 at 10:37:54
✔ Best Answer
FOR /F "tokens=*" %%G IN ('echo %teststring%') DO echo %%G

Tony


Report •

#2
June 5, 2012 at 10:39:13
FOR /F "tokens=*" %%G IN ("%teststring:"=%") DO echo %%G

How To Ask Questions The Smart Way


Report •

#3
June 5, 2012 at 11:17:18
Genious to both of your answers. I see how tonysathre's would work, I haven't seen razors format before. Thank you for the time.

:: mike


Report •
Related Solutions


Ask Question