如果文件不再存在,如何卸载Windows服务? [英] How do I uninstall a Windows service if the files do not exist anymore?
问题描述
如果服务文件不再存在,如何卸载.NET Windows服务?
How do I uninstall a .NET Windows Service, if the service files does not exists anymore?
我使用InstallUtil安装了.NET Windows服务.此后,我删除了文件,但忘记了运行
I installed a .NET Windows Service using InstallUtil. I have since deleted the files but forgot to run
InstallUtil /u
第一.因此,该服务仍列在服务" MMC中.
first. So the service is still listed in the Services MMC.
我必须进入注册表吗?还是有更好的方法?
Do I have to go into the registry? Or is there a better way?
推荐答案
您至少有三个选择.我按照使用偏好的顺序介绍了它们.
You have at least three options. I have presented them in order of usage preference.
方法1 -您可以使用 SC工具(Sc .exe)包括在资源工具包中. (包含在Windows 7/8中)
Method 1 - You can use the SC tool (Sc.exe) included in the Resource Kit. (included with Windows 7/8)
打开命令提示符并输入
sc delete <service-name>
工具帮助片段如下:
DESCRIPTION:
SC is a command line program used for communicating with the
NT Service Controller and services.
delete----------Deletes a service (from the registry).
方法2 -使用delserv
Method 2 - use delserv
下载并使用delserv命令行实用程序.这是为Windows 2000开发的旧版工具.在当前的Windows XP框中,此方法已由方法1中所述的sc取代.
Download and use delserv command line utility. This is a legacy tool developed for Windows 2000. In current Window XP boxes this was superseded by sc described in method 1.
方法3 -手动删除注册表项(请注意,这在Windows 7/8中适得其反)
Method 3 - manually delete registry entries (Note that this backfires in Windows 7/8)
Windows服务在以下注册表项下注册.
Windows services are registered under the following registry key.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
在引用的密钥下搜索带有服务名称的子密钥并将其删除. (并且您可能需要重新启动才能从服务"列表中完全删除该服务)
Search for the sub-key with the service name under referred key and delete it. (and you might need to restart to remove completely the service from the Services list)
这篇关于如果文件不再存在,如何卸载Windows服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!