-2

I have a script with:

IF "%USER_COUNTRY%"=="ie" IF NOT "%POS_TYPE%" == "ipos" ( GOTO IE_Start)

and below I have some labels:

:PT_Start
ECHO Start PT
  rem for PT Num Lock must be activated before POS start
  .\native\klocks.exe +n

    IF NOT EXIST c:\C3 GOTO NO_C3
    pushd c:\C3\
    tskill /V  /A  c3_net
    cmd /c  START /min c3_net.exe
    GOTO C3_DONE
    :NO_C3
    ECHO C3 not present in C:\C3\
    ECHO start without C3
    :C3_DONE
    popd

GOTO Start_Now

:IE_Start
ECHO Start IE

    IF NOT EXIST c:\C3 GOTO NO_C3_RPM
    pushd c:\C3\
    tskill /V  /A  c3_rpm_net
    cmd /c START  c3_rpm_net.exe
    GOTO RPM_C3_DONE
    :NO_C3_RPM
    ECHO C3 not present in C:\C3\
    ECHO start without C3
    :RPM_C3_DONE
    popd

GOTO Start_Now

:PL_Start
ECHO Start PL
    pushd c:\AModule\
    cmd /c START Forcom.AModule.exe
    echo "AModule ist gestartet"
    popd

GOTO Start_Now

I am getting:

The system cannot find the batch label specified - IE_Start

Script is run under Windows but it was saved on Unix so it has LF line-end signs. I am telling this because there are few ways to fix that problem but I don't understand why. I noticed that following fixes the problem:

  1. Changing line-end signs to CR+LF (Windows-specific);
  2. Moving IE_Start label and its part of code before PT_Start;
  3. Removing /min from cmd /c START /min c3_net.exe;
  4. Changing line from point 3) to cmd /c START /min C:\C3\c3_net.exe (this file doesn't exist anyway);

What's going on?

aschipfl
  • 33,626
  • 12
  • 54
  • 99
Mateusz Gaweł
  • 673
  • 1
  • 8
  • 22
  • this is **not** bash – Ipor Sircer Jan 10 '17 at 13:04
  • 2
    Regardless of the other issues, `:IE_Start` in your code is never run from the code block you have posted, we know it can be run from a `GOTO` elsewhere in your script. `IF /I "%USER_COUNTRY%"=="ie" (IF /I NOT "%POS_TYPE%"=="ipos" GOTO IE_Start)` . But you really need to include all of the code. – Compo Jan 10 '17 at 13:47

1 Answers1

0
IF "%USER_COUNTRY%"=="ie" IF NOT "%POS_TYPE%" == "ipos" ( GOTO IE_Start)

Your code above is not correct:

1) you are using two different if statements as a one liner.

2) the first if contains a condition but lacks the command block.

Below is the correct way of achieving what you want.

IF "%USER_COUNTRY%"=="ie" ( do something )

IF NOT "%POS_TYPE%"=="ipos" ( GOTO IE_Start)
YanivK
  • 116
  • 1
  • 5