The output is not what I expected to get... especially the first piece of the output. I
think it goes wrong with the @ token. But I couldnt find anything about it and cant
figure it out.
Does anyone know what I am doing wrong??
THNX
This is my script:
if not exist input.bat (
echo @echo off > input.bat
echo title Input >> input.bat
echo :set >> input.bat
echo MODE CON: COLS=29 LINES=5 >> input.bat
echo :loop >> input.bat
echo cls >> input.bat
echo echo Gebruik de wasd toetsen >> input.bat
echo echo om te bewegen >> input.bat
echo echo a/Left d/Right >> input.bat
echo choice /c:wscradp /n >> input.bat
echo if ERRORLEVEL 6 ( >> input.bat
echo echo d^>action.txt >> input.bat
echo goto loop) >> input.bat
echo if ERRORLEVEL 5 ( >> input.bat
echo echo a^>action.txt >> input.bat
echo goto loop) >> input.bat
echo if ERRORLEVEL 4 ( >> input.bat
echo echo r^>action.txt >> input.bat
echo goto loop) >> input.bat
echo if ERRORLEVEL 3 ( >> input.bat
echo taskkill /f /im cmd.exe >> input.bat
echo exit >> input.bat
echo ) >> input.bat
echo if ERRORLEVEL 2 ( >> input.bat
echo echo s^>action.txt >> input.bat
echo goto loop) >> input.bat
echo if ERRORLEVEL 1 echo w^>action.txt >> input.bat
echo goto loop >> input.bat
)
This is the output (the file input.bat) when input.bat doesn`t exist:
goto loop
if ERRORLEVEL 5 (
echo a>action.txt
goto loop)
if ERRORLEVEL 4 (
echo r>action.txt
goto loop)
if ERRORLEVEL 3 (
taskkill /f /im cmd.exe
exit
)
if ERRORLEVEL 2 (
echo s>action.txt
goto loop)
if ERRORLEVEL 1 echo w>action.txt
goto loop