在 Inno Setup 中重新安装和卸载时停止 Windows 服务

Stop a Windows service on re-installation and uninstallation in Inno Setup

我有一个在安装完成后启动服务的安装程序。它在卸载时停止并删除服务它停止并删除服务。应用程序成功安装后,如果我再次尝试 运行 安装程序,它会抛出一条错误消息 'Setup has detected that application is already running'。如何在安装之前停止服务?

Inno Setup 报告说,只有当您设置 AppMutex directive

如果您不希望安装程序检测到应用程序(服务)是 运行,请不要设置该指令。

如果要在检测前停止应用程序(服务),可以在InitializeSetup event function in installer, and using InitializeUninstall卸载程序中进行。 不过请注意,在用户确认任何事情之前对用户的机器进行更改是不正确的做法。