I wrote the following commands with a batch file:
@echo off
set /p a=
if %a%==1 goto 1
if %a%==2 goto 2
goto end
:1
echo 1
goto end
:2
echo 2
:end
The problem is that when entering 1 or 2, the commands are executed respectively, but what if the input is not one of 1 or 2?
So I want to ask, when the other party enters something that is not 1 or 2, how to write this script so that the window displays "No such command"
Thank you!
@echo off
set /p a=
if %a%==1 goto 1
if %a%==2 goto 2
goto end
:1
echo 1
goto end
:2
echo 2
:end
The problem is that when entering 1 or 2, the commands are executed respectively, but what if the input is not one of 1 or 2?
So I want to ask, when the other party enters something that is not 1 or 2, how to write this script so that the window displays "No such command"
Thank you!
