Thursday, November 26, 2009

How to get the Windows Service name from the Windows Service Description

Sometimes you need to stop and start a Windows Service from the Cmd line or from a batch file. To do this you need to know the Windows Service’s ‘KeyName’ rather than the display name of the service.

To get the KeyName run this command from the cmd line:

C:\sc.exe GetKeyName DisplayName

Example
C:\sc.exe GetKeyName “Windows Services Timer service”
will return Name = SPTimerV3

You can then use this name in your batch files i.e.

net stop “SPTimerV3”
net start “SPTimerV3”

No comments: