Im creating a parody of the command prompt with batch and everytime i put in an unknown command in the batch file like "JABSD" it just closes even though i already put the
if not defined (item) goto (item)
command. Here is the code:
@echo off
color 0a
echo Microbach Bachdos [version 9.9.bachcmd0a2pro]
echo Copybach (C) 1700 Microbach Corporbachtion. All Bachs reserved.
:commandbach
echo .
set "bachcmd="
set /p "bachcmd= C:\Bachusers\BACH)"
if not defined bachcmd goto invalidbcommand
REM error corrections
if /i "%bachcmd%"==" " (
:invalidbcommand
echo '%bachcmd% is not recognized as an internal or external command, operable program or .bach file.
goto commandbach
)
if /i "%bachcmd%"=="ACTBACH" (
echo Please use a valid number
echo ACTBACH symphony_number
)
REM commands
if /i "%bachcmd%"=="help" (
echo HELP Displays a list of Bach commands.
echo ACTBACH symphony_number Plays the symphony number.
goto commandbach
)
if /i "%bachcmd%"=="ACTBACH 1" (
start http://ift.tt/1D2ocUr
goto commandbach
)
if /i "%bachcmd%"=="ACTBACH 2" (
REM start (insert URL)
echo Cannot find the symphony number
goto commandbach
)
pause
Aucun commentaire:
Enregistrer un commentaire