I wrote a little script which would prompt me for an input, save that input to a text file and shutdown the PC afterwards.
This is what the code looks like:
@ECHO OFF
set /p input=Insert text:
echo %DATE%: %input% >> text.txt
echo The system will shutdown...
shutdown -s -f -t 3
When I execute the batch, it prompts me and saves the input correctly, but after displaying The system will shutdown... it doesn’t shut down, instead it starts over again promting me for input.
Does anyone know what causes this behavior?
May I ask the name of your batch file? If it is named shutdown.bat it is likely getting called again rather than executing the shutdown command. Try renaming your batch file if you would please.