notalot Posted May 13, 2009 Posted May 13, 2009 Ok I'm sure I’m being thick but I can’t get this to work correctly its always putting out a true value even though the variable is wrong and I haven't a clue why set Sophos= set /P Sophos=To run Sophos type Y otherwise type N: %=% if /i "%sophos%" ==Y goto RunSophos ELSE goto SkipSophos Echo "Fail" >>c:\test :Runsophos Echo "run" >>c:\test.txt Echo "%sophos%" >>c:\test.txt goto EndSohpos :SkipSophos echo "skip" >>c:\test.txt Echo "%sophos%" >>c:\test.txt goto EndSophos :EndSophos echo "end" >>c:\test.txt The text output is just for testing. Whenever you look in the text file it has always ran runsophos even if you have put N in Any help would be appreciated
OutToLunch Posted May 13, 2009 Posted May 13, 2009 set /p sophos=Enter Y or N echo %Sophos% pause if /i %sophos% EQU y (goto moo) else (goto boo) :moo echo moo goto endbat :boo echo boo goto endbat :endbat echo done pause Works for me - sorry, didn't have time to rejig yours but that should be apparent what's what. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now