Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
385 views
in Technique[技术] by (71.8m points)

windows - 如果文件不再存在,如何卸载Windows服务?(How do I uninstall a Windows service if the files do not exist anymore?)

How do I uninstall a .NET Windows Service, if the service files does not exists anymore?

(如果服务文件不再存在,如何卸载.NET Windows服务?)

I installed a .NET Windows Service using InstallUtil.

(我使用InstallUtil安装了.NET Windows服务。)

I have since deleted the files but forgot to run

(我已经删除了文件但忘了运行)

 InstallUtil /u

first.

(第一。)

So the service is still listed in the Services MMC.

(因此该服务仍然列在服务MMC中。)

Do I have to go into the registry?

(我必须进入注册表吗?)

Or is there a better way?

(或者,还有更好的方法?)

  ask by Thomas Jespersen translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You have at least three options.

(你至少有三个选择。)

I have presented them in order of usage preference.

(我按照使用偏好的顺序展示了它们。)

Method 1 - You can use the SC tool (Sc.exe) included in the Resource Kit.

(方法1 - 您可以使用Resource Kit中包含的SC工具 (Sc.exe)。)

(included with Windows 7/8)

((包含在Windows 7/8中))

Open a Command Prompt and enter

(打开命令提示符并输入)

sc delete <service-name>

Tool help snippet follows:

(工具帮助代码段如下:)

DESCRIPTION:
        SC is a command line program used for communicating with the
        NT Service Controller and services.

delete----------Deletes a service (from the registry).

Method 2 - use delserv

(方法2 - 使用delserv)

Download and use delserv command line utility.

(下载并使用delserv命令行实用程序。)

This is a legacy tool developed for Windows 2000. In current Window XP boxes this was superseded by sc described in method 1.

(这是为Windows 2000开发的传统工具。在当前的Window XP框中,这被方法1中描述的sc取代。)

Method 3 - manually delete registry entries (Note that this backfires in Windows 7/8)

(方法3 - 手动删除注册表项(请注意,这在Windows 7/8中适用))

Windows services are registered under the following registry key.

(Windows服务在以下注册表项下注册。)

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServices

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)

((您可能需要重新启动才能从“服务”列表中完全删除该服务))


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...