Windows service management mainly uses two Commands: SC net, where SC can modify service attributes and other information, and can add or delete services:
# View the service creation Information
C:/Documents and Settings/sina>sc create Creates a service entry in the registry and Service Database. SYNTAX: sc create [service name] [binPath= ] <option1> <option2>... CREATE OPTIONS: NOTE: The option name includes the equal sign. type= <own|share|interact|kernel|filesys|rec> (default = own) start= <boot|system|auto|demand|disabled> (default = demand) error= <normal|severe|critical|ignore> (default = normal) binPath= <BinaryPathName> group= <LoadOrderGroup> tag= <yes|no> depend= <Dependencies(separated by / (forward slash))> obj= <AccountName|ObjectName> (default = LocalSystem) DisplayName= <display name> password= <password>
C:/Documents and Settings/sina>
# Delete a service
sc delete servicename
# Start the service
sc start servicename
# Stop a service
sc stop servicename
# Query the status of all services
sc query
# Querying the status of a specified service
sc query servicename
# Querying service description
sc qdescription servicename
# Querying service configuration information
sc qc servicename
# Query the display name based on the service name
sc getdisplayname servicename
# Query the service name based on the display name
sc getkeyname displayname
# Modify service description
SC description servicename "Description"
# Modify more service configurations
SC config servicename displayname = "display name" type = ......
|
Note: SC operates on the service name (not the display name). For example, the Telnet display name is Telnet and the service name is TlntSvr.
SC start Telnet as follows:
SC start TlntSvr
SC:
SC stop TlntSvr
SC can modify the display name of a service, but cannot modify the service name. If the service name is complex, it may be difficult to write, but it cannot be modified. What should I do...
Use the net command. Net can operate the service name or service display name. If the service display name is complex, you can use SC to modify the display name, for example: the name of my apache service is very long: apmserve-Apache. It is troublesome to press it in the command, and the display name is also so long. Modify the display name:
sc config APMServe-Apache DisplayName= httpd
|
Note: spaces between httpd and equal signs must be available.
Now you can run the following command:
net start httpd net stop httpd
Of course:
net start APMServe-Apache
net stop APMServe-Apache
Yes, too.
More Net Usage:
net /?
|