How to make a running excutable delete its own file

那年仲夏 提交于 2019-12-07 05:26:26

问题


For example,

I have an excutable TrashClean.exe running. I want it to delete all files I don't want and also delete itself (TrashClean.exe on hard drive) at last step.

I am wondering if it's possible in C#?


回答1:


Please see How To Make Your Application Delete Itself Immediately:

I'm sure you've all said to yourself or someone at the office at one point or another, "<snort> You idiot. Don't you know a Windows application can't delete itself? I bet you don't even know how to type high ASCII characters using the ALT key and the number pad, gahhhh.."

Sure, there are ways to have a file delete itself on the next reboot... And you can even resort to an external program or batch file to do the work. But I just came up with a nifty way of doing it without leaving a visible trace that the application ever existed!



来源:https://stackoverflow.com/questions/5303783/how-to-make-a-running-excutable-delete-its-own-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!