Articles

Solved I'm trying to check the value of an enviornment variable

November 10, 2012 at 16:40:38
Specs: Windows 7, AMD Phenom II/8 gb

I do the following in a bat file:
@SET/P MYON=FTP OK?
@IF %MYON%=="N" ECHO NOT_OK
@ECHO %MYON%

I enter N, I DON'T get NOT_OK (the test doesn't work), N gets echoed .


See More: Im trying to check the value of an enviornment variable

Report •


#1
November 10, 2012 at 16:50:39
✔ Best Answer

@IF "%MYON%"=="N" ECHO NOT_OK

How To Ask Questions The Smart Way


Report •

#2
November 11, 2012 at 00:59:44

In your original you test whether %MYON% is equal to

"N"

Try running it and entering "N" rather than N. Razor's version corrects that. Or, simpler, just remove all the quote marks.


Report •

#3
November 11, 2012 at 07:58:59

Thank you, the fix worked fine and solved a lot of my other problems. I think that there are not too many ways to ask for input using a bat file.
JEBoyden9

Report •

Related Solutions


Ask Question