Currently I am writing a batch file to accept a parameter and jump to a specific part of the file based on the parameter value. The code I have is as follows:
SET param = %~n1
IF "%param%"=="q" GOTO :QUICK
IF "%param%"=="t" GOTO :THOROUGH
IF "%param%"=="b" GOTO :BOOT
IF "%param%"=="f" GOTO :FIX
IF "%param%"=="" GOTO :INVALID
:QUICK
echo "Quick"
pause
exit
:INVALID
echo "Invalid"
pause
exit
:BOOT
echo "Boot"
pause
exit
:FIX
echo "Fix"
pause
exit
:THOROUGH
echo "Thorough"
pause
exit
The only parameters the script should accept are /q, /t, /b or /f (or without /), and when an incorrect parameter is supplied, it should jump to INVALID. When I run it with an invalid parameter, it works, however, if I supply a parameter that is correct (for example, file.bat t) the result fails to work as I hope, and ends up going directly to INVALID. I have tried using "%param%" EQ "q", and setting q to a variable before doing the comparison, but I have had no luck coming up with a result that works.