Windows Shell - Procedures?

57 Views Asked by At

Let me start by saying I am a student and completely new to this. I have written a script according to my assignment and for someone reason the script stops after the user enters Y or N and does not call the subroutine, the window closes.

I checked each subroutine and made sure they worked but after the input from the user, the entire script halts. Here is what I have:

CALL :PrintDateTime
echo.

CHOICE /M "Do you want to continue this script? " 

IF Errorlevel 2 GOTO :ExitScript
IF Errorlevel 1 GOTO :ContinueScript

GOTO :EOF


:ContinueScript
ECHO "Thank you for continuing!"
ECHO "Your current working directory is %cd%
GOTO :EOF


:ExitScript
ECHO Goodbye!
GOTO :EOF


:PrintDateTime
ECHO The current date and time is %DATE% %TIME%
GOTO :EOF


:EOF
0

There are 0 best solutions below