Solved Batch file help - if variable statement

January 9, 2012 at 02:56:34
Specs: Windows XP
Hello

I am trying to write a script to login to a databse using a batch file but it keeps closing the file when i enter the variable either way, my syntax is wrong but i am not sure of the problem please advise. What i need is for if %variable% =oracl goto continue else goto exit

here is the part of the current script, please help

set /p %db%=enter database:
if "%db%" == oracl (goto continue) else goto exit

it exits if i type oracl or any other variable, is there a simple solution such as if %db% not equal to oracl then exit? thanks


See More: Batch file help - if variable statement

Report •


#1
January 9, 2012 at 03:16:00
✔ Best Answer
set /P db=enter database:
if /I "%db%"=="oracl" (goto :continue) else (goto :exit)


Report •

#2
January 9, 2012 at 03:33:16
thanks exactly what i was looking for.

Report •

Related Solutions


Ask Question