Reputation: 37
I currently have this menu:
echo What would you like to do?
echo.
echo Choice
echo.
echo 1 Delete File
echo 2 Ignore File
echo.
:choice
set /P C=[1,2]?
if "%C%"=="2" goto Deleting
if "%C%"=="1" goto IgnoreFile
goto choice
Although it does not seem to work, when I select an option e.g. 2 it will not goto the :IgnoreFile section, instead it will continue the script (i.e. continue with the next command in the file, after entering my choice)
Very thrustrating, I am not sur
Upvotes: 0
Views: 1187
Reputation: 267
If I understand correctly your problem, you should make a end mark to skip a sequence of your script.
@echo off
echo What would you like to do?
echo.
echo Choice
echo.
echo 1 Delete File
echo 2 Ignore File
echo.
:choice
set /P C=[1,2]?
if "%C%"=="1" goto Deleting
if "%C%"=="2" goto IgnoreFile
goto choice
:Deleting
echo Deleting
[your code]
goto end
:IgnoreFile
echo IgnoreFile
[your code]
goto end
:end
the "goto end" at the end of each case allow you to skip the reste of the script. Don't forget to make a ":end" part at the very last line of your script.
If you don't use "goto end" and selected the "Deleting" case, the deleting part would be executed and the script would keep on going and run the "IgnoreFile" case
Upvotes: 1