Sometimes you cannot delete or rename a file that is currently in use. You might receive an access violation error, or simply a message telling you that your action could not be completed because the file is open in another program.
You may have already come across the Unlocker freeware tool that lets you "unlock" files that are in use by some application.
Here is another way (let’s call it the ‘techie’ way) to unlock files that are in use. It makes use of the Process Explorer tool from Windows SysInternals.
- Download the Process Explorer tool. Execute procexp.exe
- Choose Find > Find Handle or DLL option
- Type the name of the file you want to unlock and hit Search.
- The process EXE locking the file and the path to the file are listed. Double click on the result.
- The file handle will be highlighted. Right-click on it and choose Close Handle.
Your file is now unlocked and can now be deleted, moved or renamed.
A little disclaimer here, closing handles might cause data inconsistency, loss and/or other undesirable effects. Make sure you understand what you’re doing before you do it.
About Shijaz Abdulla
Shijaz Abdulla is a Datacenter Technology Solutions Professional at Microsoft, based in Doha - Qatar and helping customers better manage their infrastructure using Microsoft technologies. He is a blogger and a technology enthusiast.