Delete Executable
-
-
Hii all, I know this may seems to be a silly question but I need to know. Is it possible to delete an Executable file from itself. e.g I have an application, I want to delete its executable file from the code written in it. Please reply. Mubashir
No, you can't. The .EXE file remains locked open so long as the code in it is loaded into a process. You'll have to quit and have an external process delete this .EXE.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
No, you can't. The .EXE file remains locked open so long as the code in it is loaded into a process. You'll have to quit and have an external process delete this .EXE.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
Well, you can load a new Assembly from an array of bytes, documented here[^]. The bytes can either be sourced from emitted code or from data in a file. The problem is creating an entirely new Process out of that Assembly. I don't know how you can get from a loaded assembly to a whole new process.
Dave Kreskowiak Microsoft MVP - Visual Basic