- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In FORTRAN, can an .EXE file delete its own image on disk at the time of execution?
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fortran, the language, has no concept of file deletion nor of "EXE". What you're asking tends to be a property of the operating system, not a particular language or compiler.
I tried the experiment with CVF on Windows, and it did not work. Indeed, the documentation says that you cannot delete a file that is currently being accessed - which you can see if you try this in Windows Explorer.
Steve
I tried the experiment with CVF on Windows, and it did not work. Indeed, the documentation says that you cannot delete a file that is currently being accessed - which you can see if you try this in Windows Explorer.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Steve. I also tried some tricks like attempting to kill the executable on disk from a thread, etc. It didn't work. My specific problem is cleaning up after installation / uninstallation. I can do everything except deleting installer/uninstaller at the end of the respective process. How do other people solve this problem in Windows? Is there always a small leftover? After your comments, I should ask my question in a different way: Are there Windows means of erasing an executable from a hard drive while executable is still working or can executable leave a request ("will") to be deleted immediately after execution? If such means exist can they be accessed from FORTRAN?
Regards,
Lev
Regards,
Lev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Most installers use a "driver" program that unpacks files used for installation, does the install, then cleans up the unpacked files. The driver program itself (usually setup.exe) is typically not automatically deleted. If you use a standard installer creation tool, this is handled for you automatically.
I'd be annoyed if an installer deleted itself after installation.
Windows does have a mechanism for doing something close to what you want - you can specify arbitrary commands to be executed on the next reboot. You've seen this at work when you uninstall a product and it tells you a reboot is needed. See here for more information.
Steve
I'd be annoyed if an installer deleted itself after installation.
Windows does have a mechanism for doing something close to what you want - you can specify arbitrary commands to be executed on the next reboot. You've seen this at work when you uninstall a product and it tells you a reboot is needed. See here for more information.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried. It works for me. The case is closed.
Thanks a lot, Steve.
Regards,
Lev
Thanks a lot, Steve.
Regards,
Lev
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page