[batch-file] Batch file to restart a service. Windows

How can I restart a windows service using a .bat file? I am on windows server.

This question is related to batch-file windows-server-2003

The answer is


net stop <your service> && net start <your service>

No net restart, unfortunately.


Examples related to batch-file

'ls' is not recognized as an internal or external command, operable program or batch file '' is not recognized as an internal or external command, operable program or batch file XCOPY: Overwrite all without prompt in BATCH CanĀ“t run .bat file under windows 10 Execute a batch file on a remote PC using a batch file on local PC Windows batch - concatenate multiple text files into one How do I create a shortcut via command-line in Windows? Getting Error:JRE_HOME variable is not defined correctly when trying to run startup.bat of Apache-Tomcat Curl not recognized as an internal or external command, operable program or batch file Best way to script remote SSH commands in Batch (Windows)

Examples related to windows-server-2003

Multiple -and -or in PowerShell Where-Object statement Batch file to restart a service. Windows Error message: (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) Domain Account keeping locking out with correct password every few minutes What possibilities can cause "Service Unavailable 503" error? ORA-12505: TNS:listener does not currently know of SID given in connect descriptor (DBD ERROR: OCIServerAttach) how to get list of port which are in use on the server How do I 'svn add' all unversioned files to SVN? Windows command to get service status? How do I measure execution time of a command on the Windows command line?