views:

518

answers:

1

Bear with me, it's been a while. :)

What is a good way to validate command-line arguments passed to an MS-DOS batch script?

For example, here is what I want to do:

IF "%1"=="" throw "Missing 1st argument: Machine Name"
IF "%2"=="" throw "Missing 2nd argument: File Path"
+2  A: 

Copied from here

IF %1.==. GOTO No1
IF %2.==. GOTO No2
... do stuff...
GOTO End1
:No1
ECHO No param 1
GOTO End1
:No2
ECHO No param 2
GOTO End1
:End1
grigy
Thanks for the help.
Jim G.