Windows 7 自/自动更新可执行文件
从 Windows 95 开始,我的程序就有了一个自定义自动更新功能。它曾经工作得很好,直到 Vista 和 Windows 7。它基本上所做的就是下载新的可执行文件,创建一个批处理文件并执行它。批处理文件只是等待父可执行文件关闭(通过不断尝试删除它),然后将下载的新文件移动/重命名为旧文件。甚至运行新下载的一个。这多年来一直运作良好。但 Windows 7 并不真正喜欢我这样做。一件事是它“知道”可执行文件不再相同(即使它们的名称和路径相同)。
有没有一种方法可以通过将可执行文件属性/权限复制到新可执行文件来默默地用新可执行文件替换可执行文件,这样 Windows 7 就不会抱怨它是一个不同的 exe? (当然我需要这个来实现自动更新功能,所以我也愿意接受其他方法)
I've had a custom auto-update feature for my programs ever since Windows 95. It used to work fine, until Vista and then Windows 7. What it basically did was to download the new executable, create a batch file and execute it. The batch file simply waited for parent executable to close (by constantly trying to delete it) and then move/rename the downloaded new one as the old one. And even run the newly downloaded one. This worked fine for years. But Windows 7 doesn't really like me to do that. One thing is that it "knows" the executables are no longer same (even though their names and paths are same).
Is there a way to silently replace an executable with a new one by copying the executable properties/permission to the new one, so that Windows 7 won't complaint about it being a different exe? (Of course I need this for auto-update feature, so I'm open to other approaches as well)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不确定您描述的警告,但我遇到了问题,我将更新放在一个单独的目录中,这破坏了任务栏中的固定项目。
一种方法是使用瘦加载程序,安装一次,然后将更新的程序加载到自己的内存空间中。这样,如果固定在任务栏中,它将被识别为同一程序。
我只熟悉使用 .NET AppDomain,但我认为大多数其他运行时也可以做到这一点。
Not sure about the warnings you describe but I have had problems where I placed the update in a separate directory which broke the pinned item in the task bar.
One approach is to have thin loader which is installed once and then loads the updated program into its own memory space. That way it will be identified as the same program if pinned in the task bar.
I'm only familiar with using .NET AppDomain but I assume most other runtimes can do it as well.
嗯 ClickOnce w/ .NET 非常适合这个...但是不知道 Windows 7 抱怨 exe 是什么意思。
Hmm ClickOnce w/ .NET works great for this... Don't know what you mean by windows 7 complaining about the exe however.