Solved for loop problems with & ^ characters not recognized command

April 1, 2013 at 13:19:39
Specs: Windows 7
I'm working on a custom decoder and I've encountered a problem.
A file decoded.txt is stored in the %tmp% folder and contains the following (ignore the begin and end lines):
-----------------Begin------------
9
&
*
v
s
Q
3
{
K
}
x

------------End---------

Now, my aim is to concentrate all of that into 1 line as a variable. My end desired result is:
"9&*vsQ3{K}x" without quotes.
However when i run the command:
for /f "delims=" %%a in ('type %tmp%\decoded.txt') do set result=!result!%%a
echo.Decoded string is:%result%
pause > nul
exit /b

It fails miserably and says:
Decoded string is:9
'*vsQ3{K}x' is not recognized as an internal or external command,
operable program or batch file.

So my question is how will i be able to successfully concentrate the content of %tmp%\decoded.txt into 1 line as a variable?


See More: for loop problems with & ^ characters not recognized command

Report •


#1
April 1, 2013 at 15:20:57
✔ Best Answer
If you're going to use delayed expansion, go whole hog!
echo.Decoded string is:!result!

How To Ask Questions The Smart Way


Report •

#2
April 1, 2013 at 15:51:38
Thanks. It works now, late here, the problems are always the slightest touches.

Report •
Related Solutions


Ask Question