in reply to Force Windows File Lock closed?

Interesting question. I looked at this and on Windows, there appears to an "Oh" command!
http://windowsxp.mvps.org/processlock.htm
So you could get this "OH command!" (Open Handles) thing and find out who is currently using this file, then kill those processes and that will release the locks on the file and then you can delete that file! The idea is not to mess with the Windows file lock yourself, but use kill process to stop everybody who is using that file and then the file is not "locked".

Now if you can't easily restart these killed processes, etc. Then I would suspect that you should rename the file that is open to some other name. Copy in the new file. Then re-boot. Once a file is open, the name doesn't matter. The running processes continue to use the old file until re-boot or restart.

If this is a daemon (service in Windoze), then you can potentially restart the service..if it is "well-behaved", it will re-init with the new file and drop the old file. The old file is "deleted" with all processes using it have closed that file. Once a file is open, something like a file id, or node id is used, not the name. You can change the name without affecting any processes currently using the file.

Replies are listed 'Best First'.
Re^2: Force Windows File Lock closed?
by NovasTaylor (Initiate) on May 18, 2009 at 17:22 UTC
    Thank you all for your replies. I will follow up on them this week! Tim