mardi 24 janvier 2017

How to use ELSE statement in .bat file that has multiple IF statements?

I'm writing a Windows batch file to enable, disable or make manual a Windows Service.

How would you use an ELSE statement if you have multiple IF options?

For example:

if /I "%c%" EQU "A"  goto :automatic
if /I "%c%" EQU "M"  goto :manual
if /I "%c%" EQU "D"  goto :disabled

I need an ELSE statement to send the script to an ECHO line that returns an error message if the user enters anything other than A, M or D.

Thanks for your help.

Aucun commentaire:

Enregistrer un commentaire