I have the following line of code in a batch file, named DriveBackup for now:
if %1%NOTSET==NOTSET call :finish 4
If the input perameter is not set/given, I call to the finish routine. I'm trying to pass in an error code (in this case, 4) so that the finish routine spits out a useful error message before the batch file terminates. I get this (echo is on)...
C:\Users\Daniel\Desktop>DriveBackup
4 was unexpected at this time.
C:\Users\Daniel\Desktop>if finish 4
C:\Users\Daniel\Desktop>
The following line in its place, works.... if %1%NOTSET==NOTSET goto donothing (a no-op)
It looks like the "call" is dropping out. How am I doing the call improperly? Can you not use an if condition to trigger a call? The finish routine is within the batch file itself. It's not a call to another batch file.
Aucun commentaire:
Enregistrer un commentaire