Delete locked file/folder from command line
Sysinternals Handle can list all open handles (to files and other objects), as well as close them. Run handle filename
to list all matching handles, then handle -c id -p pid
to close it. This is basically the same as what Unlocker does.
(Edit: Added forgotten -p
option.)
I don't know if it's possible to delete a locked file immediately, but BusyDelete will schedule the file for removal after a reboot.
BusyDelete will delete files even if they are busy. The file(s) you specify will be marked for deletion. Then the next time you reboot your system the Operating System will delete the file(s). For example BDEL ATL.DLL will delete the file during the next reboot.
There are quite a few other useful utilities there too.