如何卸载Windows服务,并删除其文件,而无需重新启动 [英] How to uninstall a windows service and delete its files without rebooting

查看:509
本文介绍了如何卸载Windows服务,并删除其文件,而无需重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前的项目涉及部署一个作为Windows服务运行的升级的.exe文件。为了用新版本覆盖现有的.exe,我目前需要:


  1. 停止服务

  2. 卸载服务

  3. 重新启动系统(以便Windows释放文件)

  4. 部署新的.exe
  5. >
  6. 重新安装服务

  7. 开始升级的服务

我想避免重新启动,以便这可以完全脚本/自动升级。



有什么办法可以避免重新启动?也许一个命令行工具,将强制Windows放弃它的死亡之握,对旧的.exe?解决方案

sc删除服务名称

会删除一项服务。我发现 sc实用程序比查找要容易得多installutil。请记住,如果您还没有停止服务。


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:

  1. Stop the service
  2. Uninstall the service
  3. Reboot the system (so Windows releases it's hold on the file)
  4. Deploy the new .exe
  5. Reinstall the service
  6. Start the upgraded service.

I'd like to avoid the reboot, so that this can be a fully scripted/automated upgrade.

Is there any way to avoid rebooting? Maybe a command-line tool that will force Windows to give up it's death grip on the old .exe?

解决方案

sc delete "service name"

will delete a service. I find that the sc utility is much easier to locate than digging around for installutil. Remember to stop the service if you have not already.

这篇关于如何卸载Windows服务,并删除其文件,而无需重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆