I am very very new to MSDOS, so sorry if this is totally obvious.
Basically, In a batch file, I need a triple IF statement that checks if 3 parameters have been given on the command line. If they are there, it uses GOTO to execute more code. If it doesn't have all three, then it echoes the error.
This is the code I have so far, that doesn't work
IF defined %1% (
IF defined %2% (
IF defined %3% (
GOTO copyoutvariables
ELSE GOTO parametererror
)
)
)
:parametererror
Echo You did not enter the right amount of parameters.
:copyoutvariables
Echo Irrelevant Code goes here.
If I enter three parameters then it goes straight to :parametererror.
I think the syntax for the ELSE is wrong. I don't really know where it should go though. Is there a better way to format the triple IF? Is there a way to AND my IF's? And where should the ELSE statement be?
Any help would be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire