DOS: check command line argument

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

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

For example, here's what I want to do:

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

      

+2


source to share


1 answer


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

      

+3


source







All Articles