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


当前回答

使用服务。msc或(启动>控制面板>管理工具>服务)以找到有问题的服务。双击查看服务名称和可执行文件的路径。

检查exe版本信息,以找到服务所有者的线索,如果可能的话,使用添加/删除程序进行干净的卸载。

如果做不到,从命令提示符中:

sc stop servicexyz
sc delete servicexyz

不需要重新启动。

其他回答

Sc删除名称

下面是传递给我的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命令,像这样(你需要在命令提示符下执行本文中的命令):

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

使用服务。msc或(启动>控制面板>管理工具>服务)以找到有问题的服务。双击查看服务名称和可执行文件的路径。

检查exe版本信息,以找到服务所有者的线索,如果可能的话,使用添加/删除程序进行干净的卸载。

如果做不到,从命令提示符中:

sc stop servicexyz
sc delete servicexyz

不需要重新启动。

如上所述,我执行:

sc delete ServiceName

然而,这并没有工作,因为我是从PowerShell执行它。

当使用PowerShell时,您必须指定sc.exe的完整路径,因为PowerShell为sc分配了一个默认别名给Set-Content。因为它是一个有效的命令,它实际上并不显示错误消息。

为了解决这个问题,我执行了如下命令:

C:\Windows\System32\sc.exe delete ServiceName