DOS Batch IF statement problems
Posted: 12 Sep 2011 11:46
I have a really weird problem. It is almost like there is some setting in my cmd prompt window environment that is making the IF command work incorrectly.
here is the cmd file I am trying to run:
Every time I run this the IF command evaluates to FALSE. Now that's NOT supposed to happen: especially when you Hardcode both variable.
Any help will be appreciated!
here is the cmd file I am trying to run:
Code: Select all
@echo off
set str1="Default Web Site"
set str2="Default Web Site"
echo %str1%
echo %str2%
REM @echo on
IF /I (%str1% EQU %str2%) (
echo %_WebSiteName% Found bsw!
goto :siteFound
)
echo %_WebSiteName% NOT Found bsw!
:siteFound
echo.
pause
Every time I run this the IF command evaluates to FALSE. Now that's NOT supposed to happen: especially when you Hardcode both variable.
Any help will be appreciated!