Desktop shortcut to restart a windows service

Jon Winstanley picture Jon Winstanley · Jan 3, 2010 · Viewed 53k times · Source

Is it possible to create a windows desktop shortcut that will restart a windows service?

I'd like a button to restart my apache service after I have made changes to the config file.

Answer

Daniel A. White picture Daniel A. White · Jan 3, 2010

You can do this in a batch file, then make a shortcut to it.

Create a text file with the following content, but save it with the file extension .bat

net stop "Service Name"
net start "Service Name"

Once the file exists, you can create a shortcut to it, and even assign a keyboard shortcut too if deemed necessary.