How can I script a bat or cmd to stop and start a service reliably with error checking (or let me know that it wasn't successful for whatever reason)?
Windows – Stop and Start a service via batch or cmd file
batch-filecmdcommand linewindows
Related Topic
- Windows batch files: .bat vs .cmd
- Windows – How to do something to each file in a directory with a batch script
- Windows – How to get current date/time on the Windows command line in a suitable format for usage in a file/folder name
- Windows – How to prevent auto-closing of console after the execution of batch file
- Windows – Redirect Windows cmd stdout and stderr to a single file
- How to “comment-out” (add comment) in a batch/cmd
- Keep CMD open after BAT file executes
Best Answer
Use the
SC
(service control) command, it gives you a lot more options than juststart
&stop
.