I'm trying to make a batch script that behave almost like a Linux command in terms of arguments. Here is the idea of the script.
When I run the script with the scenarios described in the code it seems to work fine. The problem that I have is coming when I tried to test the program with wrong parameters. For the 1st parameter being either -manual or -automat and the 2nd parameter being wrong the behave is normal, the program prints "Invalid Argument".
The problem that I encounter is when the 1st argument is not -manual or -automat. In this case I get the error: goto was unexpected at this time.
Does any1 have any idea why this is happening and how can I solve the problem?
@echo off
IF %1!==! goto Result0
IF %1==-manual IF %2!==! goto Result1_manual
IF %1==-automat IF %2!==! goto Result1_auto
IF %1==-manual IF %2==1 goto Result2_manual
IF %1==-manual IF %2==2 goto Result3_manual
IF %1==-automat IF %2==1 goto Result2_auto
IF %1==-automat IF %2==2 goto Result3_auto
:done
echo "Invalid argument"
pause
cmd /k
:Result0
echo "Result0"
pause
cmd /k
:Result1_manual
echo "Result1_manual"
pause
cmd /k
:Result2_manual
echo "Result2_manual"
pause
cmd /k
:Result3_manual
echo "Result3_manual"
pause
cmd /k
:Result1_auto
echo "Result1_auto"
pause
cmd /k
:Result2_auto
echo "Result2_auto"
pause
cmd /k
:Result3_auto
echo "Result3_auto"
pause
cmd /k