Computer Hope
Software => Computer software => Topic started by: manas0603 on February 09, 2009, 11:45:45 PM
-
Hi All,
I am running a windows batch file which will accept a single value as a parameter.
The value is either 0 or 1.
Inside the batch file i want to check if the parameter is not 0 or 1 then it will generate an error.
It is something like this.
IF <PARAMTER VALUE> NOT IN (0,1) THEN
GOTO :PARAMETER_ERR
Please let me know how to do this. I am using windows XP and windows 2003 server
-
Maybe something like this?
@Echo Off
If [%1] EQU [] (Echo Param required & Goto End)
If %1 LSS 0 (Goto ParamError) Else If %1 GTR 1 (Goto ParamError)
Echo Param passed was %1
Goto End
:ParamError
Echo Wrong parameter passed. Must be 0 or 1
:End
-
What is the purpose of this batch file?