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.
Press the Win + R keys on your keyboard, to open the Run window. Then, type "services. msc" and hit Enter or press OK. The Services app window is now open.
So I created a LNK shortcut which points to the batch script web_servers_start. cmd and checked "Run as administrator" in the file's Properties dialog under the "Advanced..." button on the Shortcut tab. You can place the LNK shortcut on the desktop, start menu or wherever you prefer.
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.
You can accomplish this without a batch file using the following shortcut target:
C:\Windows\System32\cmd.exe /c "net stop "Service Name" & net start "Service Name""
In addition to the answer the following comment by Tibo is mandatory:
To make it run as Administrator (required for some services, maybe all?), in the shortcut's properties window, tab Shortcut, clic on the button "Advanced..." (at the bottom) then check "Run as administrator". It will open the User Account Control popup each time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With