Link to home
Start Free TrialLog in
Avatar of lauren_it
lauren_it

asked on

Error trapping in batch file - "net" command?

I've created a batch file to use the "net" command to stop a specific service, copy files, then start the service again.  If the service doesn't stop properly, for whatever reason, I would like the batch script to exit instead of continue on.  Anyone ever do this, or have any ideas?
ASKER CERTIFIED SOLUTION
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lauren_it
lauren_it

ASKER

Thanks, I'll look into the SC command.  For now I realized the simple "if ERRORLEVEL 1 goto" will work.  Maybe I'll get a little more fancy with it using SC in the future.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial