How to uninstall a windows service and delete its files without rebooting

后端 未结 10 1909
终归单人心
终归单人心 2021-01-30 16:40

My current project involves deploying an upgraded .exe file that runs as a Windows Service. In order to overwrite the existing .exe with the new version, I currently need to:

10条回答
  •  悲&欢浪女
    2021-01-30 17:21

    My batch file to stop and delete service

    @echo off
    title Service Uninstaller
    color 0A
    set blank=
    set service=blank
    :start
    echo.&echo.&echo.
    SET /P service=Enter the name of the service you want to uninstall:  
    
    IF "%service%"=="" (ECHO Nothing is entered
    GoTo :start)
    cls
    echo.&echo.&echo We will delete the service: %service%
    ping -n 5 -w 1 127.0.0.1>nul
    ::net stop %service%
    ping -n 2 -w 1 127.0.0.1>nul
    sc delete %service%
    pause
    :end
    

提交回复
热议问题