使用bat文件自动更新
我实现了我的应用程序的自动更新。下载安装程序结束时,我必须
- 关闭我的应用程序
- 执行新版本的安装程序。
我尝试使用以下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
- close my application
- 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在安装程序本身中编写任务,而不是在批处理文件中执行。安装程序可能会检查旧应用程序实例是否打开,当它打开时,他会尝试关闭它。成功后 - 他将开始真正的安装。
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.