How to make two shortcuts: Enable+Start service & Disable+Stop any windows service?
How do I enable/start and stop/disable the Windows Update Service from cmd
?
You can do this using sc
commands.
- Either assign the commands to a shortcut or add them to a batch file and assign the batch file to a shortcut.
- To do the same with any other service replace
wuauserv
with the service name.
Enable/Start:
sc config wuauserv start= auto & sc start wuauserv
Stop/Disable:
sc stop wuauserv & sc config wuauserv start= disabled
Example output:
> sc config wuauserv start= auto & sc start wuauserv
[SC] ChangeServiceConfig SUCCESS
SERVICE_NAME: wuauserv
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 2 START_PENDING
(NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x7d0
PID : 1204
FLAGS :
> sc stop wuauserv & sc config wuauserv start= disabled
SERVICE_NAME: wuauserv
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 3 STOP_PENDING
(NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x1
WAIT_HINT : 0x7530
[SC] ChangeServiceConfig SUCCESS
Further Reading
- An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
- sc - Service Control - Create, Start, Stop, Query or Delete any Windows SERVICE.