程序如何删除自己的可执行文件

程序如何删除自己的可执行文件

本文介绍了程序如何删除自己的可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如,我制作一个控制台应用程序(单独的exe),在做一些任务之后以某种方式删除exe文件。



我必须向某人发送单个文件。而且我希望在完成任务之后删除它。



有没有办法在Windows中执行

解决方案

一种方法是使用函数与 MOVEFILE_DELAY_UNTIL_REBOOT 标志和 NULL 目的地。根据文档,这样:


Is there any way that a running process can delete its own executable?

For example, I make a console application (single exe) and after doing some tasks it somehow deletes the exe file.

I have to send a single file to someone. And I want it deleted after it does its intended task.

Is there anyway to do it in Windows

解决方案

One way to do this is to use the MoveFileEx function with the MOVEFILE_DELAY_UNTIL_REBOOT flag and a NULL destination. According to the documentation, this:

这篇关于程序如何删除自己的可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 11:12