Deleting a file currently in use

I need to write a very simple uninstaller program that will remove a few .txt files and a couple of folders as well as a .exe file. I know how to delete the folders and files however i'm not sure how to get rid of the .exe file. The problem is i need to delete the exe file that is being used to delete all the other files/folders. When run, it says access is denied (I'm assuming because i'm trying to delete a file that's being used). Is there anyway around that? Can I delete a file that's in use?
Last edited on
Not that I know of...unless you have the .exe run a different .exe, close, then have the other .exe delete the original one...
> Can I delete a file that's in use?
No.

Google the "RunOnce" registry option to learn about how Windows handles this problem.

Personally, I always just use Inno Setup
http://www.innosetup.com/
to handle installer/uninstaller stuff.

Hope this helps.
thanks! the inno installer is exactly what i was looking for.
Topic archived. No new replies allowed.