[英]Self Deleting Executable (Uninstaller)
I'm trying to make an uninstaller.我正在尝试制作卸载程序。 I basically need to be able to remove a directory in the program files that contains the uninstaller.我基本上需要能够删除程序文件中包含卸载程序的目录。
I was thinking to have the uninstaller create a copy of itself to the temp folder, then have the uninstaller running from the program folder open the uninstaller in temp and close itself where it continues the uninstall.我正在考虑让卸载程序在临时文件夹中创建自己的副本,然后让从程序文件夹运行的卸载程序在临时文件夹中打开卸载程序并在继续卸载的地方关闭自身。
Problem is, how do I delete the uninstaller in the temp folder...问题是,如何删除临时文件夹中的卸载程序...
Check out: https://www.catch22.net/tuts/win32/self-deleting-executables查看: https ://www.catch22.net/tuts/win32/self-deleting-executables
He has multiple solutions - but mostly aimed at C++ code.他有多种解决方案——但主要针对 C++ 代码。
I am currently trying to implement the "DELETE_ON_CLOSE" method in C#.我目前正在尝试在 C# 中实现“DELETE_ON_CLOSE”方法。
A comment to all the nay-sayers: MSI does not solve this problem in all cases.对所有反对者的评论: MSI 并不能在所有情况下解决这个问题。 In my case, my application needs to install to a network folder, where any network user can run the app.在我的例子中,我的应用程序需要安装到一个网络文件夹,任何网络用户都可以在其中运行该应用程序。 It also needs to support upgrades and uninstalls from any network workstation - not necessarily the same workstation that installed the app.它还需要支持从任何网络工作站进行升级和卸载——不一定是安装该应用程序的同一工作站。 This means I cannot register an Uninstaller into the Add/Remove Programs list on the local machine.这意味着我无法将卸载程序注册到本地机器上的添加/删除程序列表中。 I must create an Uninstall.exe that is dropped into the install folder.我必须创建一个放入安装文件夹的 Uninstall.exe。 MSI does not support that, so I have to write my own. MSI 不支持那个,所以我必须自己写。
Even though I agree with everyone saying you shouldn't do that, what you can do is:尽管我同意大家说你不应该那样做,但你可以做的是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.