I am trying to make a batch file that creates another batch file (Compile.bat) and need to echo the %errorlevel% variable into Compile.bat, but since it's a global variable when it is called is uses current value.
This is the code
ECHO if NOT "%errorlevel%"=="0" PAUSE >> .\%name%\Compile.bat
But Compile.bat receives
if NOT "0"=="0" PAUSE
Is there a way to stop it from thinking %errorlevel% is a variable?