我有两个旧的服务,我想完全卸载。我该怎么做呢?


当前回答

使用SC命令,像这样(你需要在命令提示符下执行本文中的命令):

SC STOP shortservicename
SC DELETE shortservicename

Note: You need to run the command prompt as an administrator, not just logged in as the administrator, but also with administrative rights. If you get errors above about not having the necessary access rights to stop and/or delete the service, run the command prompt as an administrator. You can do this by searching for the command prompt on your start menu and then right-clicking and selecting "Run as administrator". Note to PowerShell users: sc is aliased to set-content. So sc delete service will actually create a file called delete with the content service. To do this in Powershell, use sc.exe delete service instead


如果需要查找服务的短服务名,使用以下命令生成包含服务列表及其状态的文本文件:

SC QUERY state= all >"C:\Service List.txt"

要获得更简洁的列表,执行以下命令:

SC QUERY state= all | FIND "_NAME"

简短的服务名称将被列在显示名称的上方,如下所示:

SERVICE_NAME: MyService
DISPLAY_NAME: My Special Service

因此要删除该服务:

SC STOP MyService
SC DELETE MyService

其他回答

下面是传递给我的vbs脚本:

Set servicelist = GetObject("winmgmts:").InstancesOf ("Win32_Service")

for each service in servicelist
    sname = lcase(service.name)
    If sname = "NameOfMyService" Then 
        msgbox(sname)
        service.delete ' the internal name of your service
    end if
next

Sc删除名称

我们有两种不同的方法

通过注册表删除Windows服务

如果你知道正确的路径,很容易从注册表中删除服务。以下是我的做法:

执行Regedit或Regedt32 打开注册表项“HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services” 寻找要删除的服务并删除它。您可以查看这些键来了解服务正在使用哪些文件,并在必要时删除它们。

通过命令窗口删除Windows服务

您也可以使用命令提示符删除服务,如下所示:

sc删除

还可以使用以下命令创建服务

sc create "MorganTechService" binpath= "C:\Program Files\MorganTechSPace\myservice.exe"

注意:您可能必须重新启动系统才能在服务管理器中更新列表。

这在Windows 10上很管用:

以管理员身份启动cmd.exe 运行SC DELETE "com.docker.service" 重新安装码头工人

如果它们是。net创建的服务,您可以使用带有/u开关的installutil.exe 它在。net framework文件夹中 C:\Windows\ Microsoft.NET \ Framework64 \ v2.0.50727