0

I'm trying to run the below If condition but I'm not receiving any result.

IF %config%=="Yes" goto :findmerge
goto :endscript
:findmerge
cd M:\%viewname%\%vobname%
set /p branchname=Enter Branch Name:
set /p labelname=Enter Branch Name:
cleartool findmerge . -nc -fver .../%branchname%/%labelname% -print

:endscript
echo "Set Config Spec to Main/LATEST"

What could be the problem with this block?

slugster
  • 49,403
  • 14
  • 95
  • 145
user3437212
  • 637
  • 1
  • 10
  • 20

1 Answers1

1

As mentioned in "string comparison in batch file", adding double-quotes around the environment variable is needed here (as Harry Johnston commented).

How can put an else condition in windows?

In your, you already have a "else":

IF /I "%config%"=="Yes" goto :findmerge
goto :endscript

That means if ... then findmerge else endscript.

The other technique, as shown in "if/then/else statements in Windows batch" is using ()

if xxx (
  ...
) else (
  ...
)
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250