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

后端 未结 10 1897
终归单人心
终归单人心 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:15

    Both Jonathan and Charles are right... you've got to stop the service first, then uninstall/reinstall. Combining their two answers makes the perfect batch file or PowerShell script.

    I will make mention of a caution learned the hard way -- Windows 2000 Server (possibly the client OS as well) will require a reboot before the reinstall no matter what. There must be a registry key that is not fully cleared until the box is rebooted. Windows Server 2003, Windows XP and later OS versions do not suffer that pain.

提交回复
热议问题