Perkentha1
asked on
Append variables from one BATCH to another.
I need to carry over variables from one bat file to another for instance
Bat 1 executes
Echo.set /p var1:"questestion?" >> c:\temp.bat
echo. if /i "%var1%"=="answer" (goto:net) >> c:\temp.bat
Problem:
echo. /i "%var1%"=="answer" (goto:net) >> c:\temp.bat
write out like this
if /i ""=="answer" (goto:net)
I need the %var1% to carry over too!
Bat 1 executes
Echo.set /p var1:"questestion?" >> c:\temp.bat
echo. if /i "%var1%"=="answer" (goto:net) >> c:\temp.bat
Problem:
echo. /i "%var1%"=="answer" (goto:net) >> c:\temp.bat
write out like this
if /i ""=="answer" (goto:net)
I need the %var1% to carry over too!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That's one problem...
And to answer your question, use the escape character and don't use a colon in the gotos.
echo. /i "^%var1^%"=="answer" (goto net) >> c:\temp.bat
And to answer your question, use the escape character and don't use a colon in the gotos.
echo. /i "^%var1^%"=="answer" (goto net) >> c:\temp.bat
leew, I thought that would be correct, but it doesn't appear to work:
/i "^"=="answer" (goto net)
/i "^"=="answer" (goto net)
ASKER
I recieved the same results, %%var%% works, I woulda have never thought to do that even though it did cross my mind.
Thanks for the help both of you!
Thanks for the help both of you!
Echo.set /p var1:"questestion?" >> c:\temp.bat
to this:
Echo.set /p var1="questestion?" >> c:\temp.bat