sc.exe 删除sc.exe delete

从注册表中删除服务子项。Deletes a service subkey from the registry. 如果服务正在运行,或者如果另一个进程具有该服务的打开句柄,则该服务将标记为删除。If the service is running or if another process has an open handle to the service, the service is marked for deletion.


建议你不要使用此命令删除内置的操作系统服务,例如 DHCP、DNS 或 Internet Information Services。We don't recommend you to use this command to delete built-in operating system services such as DHCP, DNS, or Internet Information Services. 若要安装、删除或重新配置操作系统角色、服务和组件,请参阅 安装或卸载角色、角色服务或功能To install, remove, or reconfigure operating system roles, services and components, see Install or Uninstall Roles, Role Services, or Features


sc.exe [<servername>] delete [<servicename>]


参数Parameter 说明Description
<servername> 指定服务所在的远程服务器的名称。Specifies the name of the remote server on which the service is located. 名称必须使用通用命名约定 (UNC) 格式 (例如, \ myserver) 。The name must use the Universal Naming Convention (UNC) format (for example, \myserver). 若要在本地运行 SC.exe,请不要使用此参数。To run SC.exe locally, don't use this parameter.
<servicename> 指定 getkeyname 操作返回的服务名称。Specifies the service name returned by the getkeyname operation.
/?/? 在命令提示符下显示帮助。Displays help at the command prompt.


若要从本地计算机上的注册表中删除服务子项 NewServ ,请键入:To delete the service subkey NewServ from the registry on the local computer, type:

sc.exe delete NewServ

其他参考Additional References