使用bat文件自动更新

发布于 2024-11-07 04:10:39 字数 405 浏览 8 评论 0原文

我实现了我的应用程序的自动更新。下载安装程序结束时,我必须

  1. 关闭我的应用程序
  2. 执行新版本的安装程序。

我尝试使用以下bat脚本来做到这一点:

sleep 5
"C:/DOCUME~1/.../.../Temp\my_app_installer.exe" 

在我的主程序代码中我写道:

ShellExecute(0, L"open", batScriptPath.utf16(), 0, 0, SW_HIDE);
closeApp();

但它不起作用。关闭应用程序之前不会调用睡眠功能并执行安装程序。这不好。你能告诉我如何修复这个错误或更新应用程序的其他方法吗?

谢谢。

I implement auto updating of my application. At the end of downloading installer I have to

  1. close my application
  2. execute installer with new release.

I try to do that using the following bat script:

sleep 5
"C:/DOCUME~1/.../.../Temp\my_app_installer.exe" 

In my main program code I write:

ShellExecute(0, L"open", batScriptPath.utf16(), 0, 0, SW_HIDE);
closeApp();

But it doesn't work. sleep function is not invoked and installer is executed before closing application. It's not good. Could you say me how can I fix this bug or another method of updating application.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

葬シ愛 2024-11-14 04:10:39

您可以在安装程序本身中编写任务,而不是在批处理文件中执行。安装程序可能会检查旧应用程序实例是否打开,当它打开时,他会尝试关闭它。成功后 - 他将开始真正的安装。

You can write your task in the installer itself, instead of doing it in a batch file. the installer may examine if there old-app-instance open, and while it's open he'll just trying to close it. After success - he'll start the real installation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文