Setting variables not working in IF statement

May 17, 2011 at 12:55:02
Specs: XP/Win7
I am having trouble getting some variables to store inside an IF statement.

Assume these variables are set as such:

set dbudp=C:\temp
set ANSWER=1

On calling the below script the two variables set retain their null values and do not take on the names given.
Am I missing something obvious?

if /i {%ANSWER%}=={1} (
	ECHO.reached 1
	pause
	SET podtype=Non-Secure Fueling Truck
	SET verpath=%dbudp%\%podtype%
	pause
	echo.podtype = %podtype%
	echo.verpath = %verpath%
	pause
	CALL "%verpath%\ReleasedApplicationVersion.cmd"
	goto:eof)


See More: Setting variables not working in IF statement

Report •


#1
May 17, 2011 at 12:57:29
Am I missing something obvious?
Yes.

How To Ask Questions The Smart Way


Report •

#2
May 17, 2011 at 13:00:20
Haha, perfect reply. Thanks!

I forgot that the changes in variables were not reflected until after the IF statement was closed.

Thanks again for the backhand!


Report •

Related Solutions


Ask Question