I'm trying to delete a locked file using AutoHotKey v1/v2 without the use of any 3rd party software. The file is created and locked by another process which I don't want to terminate.
When I try to use FileDelete, I get the following error message:
Error: (32) The process cannot access the file because it is being used by another process.
Running as Administrator doesn't fix the issue. It's my understanding that in order to delete this file, I must first retrieve the handle(s) associated with the locked file from the owned process, and close them.
I tried using the script GetProcessHandles.ahk in order to achieve this. This works for some processes, but when I try to retrieve the handles from the process ID that's using the locked file, the script freezes and I'm unable to even exit the script from the system tray.
Any help would be much appreciated!
I came across the script WhoLockedMe, which works great.