How do I delete a locked file in Windows?

Use the openfiles command to identify and disconnect users who have the file open. If that doesn't work, download the Unlocker utility.

Openfiles syntax:

openfiles.exe /query
openfiles.exe /disconnect /id openFileID

1.) Open `computer management', (right-click "My Computer", select
`Manage')

2.) Scroll down to `Shared Folders', expand.

3.) Select/click on `Open Files'. Double/triple-check to make sure
nobody has it open.

If you're good on the above, a too-deep file/folder path might be giving you some grief. Try navigating several folders towards the root, then cutting and pasting them to reduce some of that path. Alternately, you could rename the folders in the path to "1", "2", "3", etc. Cutting down on some of the extraneous characters.


SysInternals has a tool called MoveFile that will do move or delete the file upon reboot of the machine.

MoveFile link


I see this all the time, you can also run Systernal's Process Explorer to find who has the file, here's a great how-to on using Process Explorer for this purpose: Unlocking files that are in use

I personally like this way since I have this tool on my USB drive and can run it without having to install it.