Code: Select all
set /p "command=C:\>"
if "%command%"=="%command:start=%" (
goto CONTAINCHECK2
) ELSE (
goto GOTO
)
:CONTAINCHECK2
if "%command%"=="%command:goto=%" (
echo Command not recognized...
goto COMMANDPRO
) ELSE (
goto GOTO
)
:GOTO
%command%
goto COMMANDPRO
It checks if the entered variable contains "goto" or "start", if yes it starts an entered program (Ex. start iexplore) or it goes to a section of my code (Ex. goto START). The problem is, if you enter a program that does not exist, or if you want to go to a section of code that doesnt exists, it just closes my batch file... How could I make that it checks if that section or program exists before going to :GOTO and if it doesnt exists I want it to go to a section ":GOTONOT". Any help would be very appreciated!