SC 命令
作者:孤剑 地址: http://blog.csdn.net/AloneSword/
昨天晚上没有事情可干,在翻书的时候看到了sc命令,利用msdn2005beta查询的一下,得到如下的文章的,感觉不错。这里命令是在命令行下修改服务的.现在不是很多黑客、木马经常使用注册为系统的服务来躲避查杀,可能就是使用了sc命令的,现在刚好自己看看学习学习,所以我就对照翻译了一下此文章,很多地方翻译的不好,希望大家谅解。同时,有一些地方我感觉自己不会翻译,就用其他的颜色画出来,希望能看到此文的人帮忙再翻译一下,这样大家可以方便交流交流。
[以下文章中红色内容为翻译不全或不完整的地方,请大家帮忙看看]
[英文原文]
Service Control Utility
The Service Control utility (SC.exe) is useful for testing and debugging your service program. SC implements calls to all of the service control functions. You can specify any function parameters through the command line. You can create batch files that call SC with various command lines to see how your service behaves with repeated starting and stopping.
SC also displays complete status information, including state, checkpoint number, and wait hint.
Windows Me/98/95: This tool is not supported.
The following is the command-line syntax for SC:
sc [ServerName] Command ServiceName [OptionName= OptionValue…]
ServerName
Name of the server if you are running the commands on a remote computer. The name must start with two backslash characters. If you are running the commands on the local computer, do not supply this parameter.
Command
One of the following SC commands.
Command
|
Description
|
Config |
Changes the configuration of a service (persistent). |
Continue |
Sends a CONTINUE control request to a service. |
Control |
Sends a control to a service. |
Create |
Creates a service (adds it to the registry). |
Delete |
Deletes a service (from the registry). |
EnumDepend |
Enumerates service dependencies. |
GetDisplayName |
Gets the display name for a service. |
GetKeyName |
Gets the name of the registry key for a service. |
Interrogate |
Sends an INTERROGATE control request to a service. |
Pause |
Sends a PAUSE control request to a service. |
Qc |
Queries configuration for the service. For detailed information, see the reference section, "SC QC." |
Query |
Queries the status for a service, or enumerates the status for types of services. For detailed information, see the reference section, "SC QUERY." |
Start |
Starts a service. |
Stop |
Sends a STOP request to a service. |
ServiceName
Name given to the service key in the registry. This is different from the display name that you see in the Service control panel application.
OptionName
Name of an optional command parameter. You can supply zero or more optional pairs of parameter names and values. For a list of available names, use the command sc command, where command is a valid command name, as listed for Command.
OptionValue
Value for the parameter named by OptionName. For a list of available values, use the command sc command, where command is a valid command name, as listed for Command.
To display help information for a command, use the following command-line syntax:
sc [Command]
where Command has the values listed previously. The exception is the Query command, which causes SC to list the status of all running services. For help on the Query command, use the command sc and type y at the prompt, "Would you like to see help for the QUERY command?'
【译文:】
服务控制功能:
Sc.exe对测试和调试系统服务程序是非常有用的。SC执行控制所有服务控制功能。你可以通过命令行详细指明任何一种功能参数。你可以创建一些带各种参数的命令行的SC检查服务重新的启动和停止的文件。
SC也可以显示完整的状态信息,包括状态、检查点、数目和等待暗示。
Windows me/98/95:改工具不支持
以下是SC的命令语法:
Sc [ServerName] Command ServerName [OptionName=OptionValue…]
ServerName
如果你在远程计算机上运行命令,ServerName就是远程计算机的名称。ServerName名称必须以两个反斜杠开头(“//”),如果你是在本地运行命令行,可以省略这个参数。
命令行:
一下是SC的命令的某一个
命令行 |
描述 |
Config |
改变一个(顽固的)服务的配置 |
Continue |
发送一个CONTINUE命令控制要求到服务器 |
Control |
发送一个控制命令到服务器 |
Create |
创建一个服务(添加这个服务到注册表) |
Delete |
删除一个(从注册表中)服务 |
EnumDepend |
枚举服务 |
GetDisplayName |
得到一个服务的显示键值 |
GetKeyName |
得到一个服务的注册表键值 |
Interrogate |
发送一个服务的INTERROGATE控制要求 |
Pause |
发送一个PAUSE控制要求给服务 |
Qc |
询问服务的配置信息。更多的信息,查看案例部分SC QC |
Query |
询问服务的状态,或则列举服务类型的状态 |
Start |
开启服务 |
Stop |
发送一个停止命令给服务 |
ServiceName
在注册表中的键值被用来表示服务的关键值的名称。这个和你在服务控制面板应用里所见到的不一样。
OptionName
一个可选命令参数的名称。你可以使用空参数或者一套可选的参数名称和键值。为得到可使用名称的列表,请使用命令:sc command。这里的command是一个显示在command中的有根据的命令名。
OptionValue
被命名为OptionName的参数值。为得到可使用名称的列表,请使用命令:sc command。这里的command是一个显示在command中的有根据的命令名。
为得到命令帮助信息,使用下面的命令语法:
sc [Command]
这里的Command参数拥有先前列出的键值。一个例外的就是用来列出所有正在运行服务的状态的Query命令。为得到query命令的帮助,使用命令sc,同时在提示“Would you like to use help for the QUERY command?”的时候键入“y”