Although there are usually several ways you can delete a file on your Windows system, you'll run into problems if the file is locked. Windows locks or restricts access to a file in order to prevent more than one user or application from deleting or altering it. Also, after you close down an application or it crashes, software bugs may prevent it from releasing files in a timely manner. No matter why a file is locked, however, there are multiple methods you can use to force Windows to delete a locked file.
Video of the Day

Close the Application Using the File
Step
Examine the file extension to determine which application it may belong to. For example, a file with a .docx file extension is probably being kept open by Microsoft Word.
Step
If you can't determine the application from its file extension, right-click it, click "Open with," and then see what application options Windows gives. For instance, a file with a .html extension may be opened by Notepad, WordPad or an HTML editor like Dreamweaver.
Step
Close the application that is currently using the file and then try again to delete it. If the file is no longer in use, you can delete it.
FileASSASSIN File Unlocker
Step
Download FileASSASSIN directly from the Malawarebytes website (see Resources). Double-click the downloaded file to install FileASSASSIN and then run it.
Step
Click the ellipses button to launch the file manager. Navigate to the folder containing the file you want to delete.
Step
Select the locked file and then click "Open."
Step
Check the "Unlock locked file handles," "Unload modules," "Terminate the file's process" and "Delete file" check boxes. With these options selected, FileASSASSIN is free to shut down any program, dynamic library or system process that is preventing your file from being deleted.
Step
Click "Execute" to delete the file. Once the file is deleted, FileASSASSIN will display the message "The file was deleted successfully!"
Using IObit Unlocker
Step
Download and install Unlocker directly from the IObit Website (see Resources). Launch Unlocker and then click "Yes" to give the program permission to make changes to your system.
Step
Launch Windows File Explorer and then locate the file you want to delete.
Step
Drag the file to the text box in IObit and then click "Add."
Step
Click the downward-facing arrow next to the Unlock button, select "Unlock & Delete" and then click "OK" to delete your file.
Unlock With LockHunter
Step
Download LockHunter directly from the LockHunter Website (see Resources). Install and launch the program.
Step
Click the ellipses icon to launch the file manager, click "Browse for a file" and then navigate to the folder containing the file you want to delete.
Step
Select the locked file and then click "Open."
Step
Click "Unlock It" and then "Delete It" to remove the file.