How can I rename files and folders in Windows that are in use?

Give LockHunter a try, which can unlock any handlers that may have locked your files or folders. Unlike similar freewares, it supports both 32 and 64-bit Windows.

It is a free tool to delete files blocked by something you do not know. LockHunter is useful for fighting against malware, and other programs that are blocking files without a reason. Unlike other similar tools it deletes files into the recycle bin so you may restore them if deleted by mistake.

  • Shows processes locking a file or folder
  • Allows to unlock, delete, copy or rename a locked file
  • Allows to kill locking process
  • Allows to remove locking processes from hard drive
  • Integrates in to Explorer menu
  • It deletes files into the recycle bin, so you may restore them if deleted by mistake
  • Supports both 32 and 64bit Windows

TL;DR? Read bold!

If you don't want external tools, or want a quick way to identify what process keeps your file in use. Then you can use a Windows Sysinternals tool called Process Explorer. You don't even have to extract a zipfile if you want to, just fetch the live version of Process Explorer from http://live.sysinternals.com/procexp.exe, which makes it easy to use this any time, any where, as long as you have internet (or if you had put it on an USB before you departed).

The bonus is that you can also use it for all your other Process related tasks...

process explorer

Process Explorer is meant as an IT Professional replacement of the Task Manager; amongst other alternatives like the Performance Monitor, Resource Monitor or an external tool like Process Hacker.

The feature you are looking for in this tool from Microsoft is as simple as it gets, it's CTRL+F which allows you to substring search for Handles or DLL files. If you would rather use your mouse and the menus, you can click on Find ➯ Find Handle or DLL.

Let's suppose that the Arial font files are in use, we can simply search for Arial and get to see that Instantbird and Firefox like to keep that font file in use. Let's suppose I would want to delete that file, I wouldn't be able to do so. Let's put a change to that and get rid of the Arial file. Don't do this at home...

Process Explorer Search

A simple fix would be to just close these two programs, while this works for Instantbird it seems that I can't shut down Firefox because I am writing this answer for you. And I don't want to risk losing my answer because of a cache timeout or a clipboard failure. So, I'm going to close all the Firefox handles to Arial.

Make sure Process Explorer is started as an administrator, then select File ➯ Show Details for All Processes

I simply select the handle in the search window and Process Explorer will automatically select Firefox and jump to the right entry in its main window. Make sure that you do this on a handle and not on a DLL, it might or might not be that you need to close the program if it were a DLL. It's time to close those handles so that I can remove the Arial font files for no reason; well, I can always restore them from a back-up...

Close handle

So, I simply right click on the relevant entries and click Close Handle.

And now, with a Firefox that has no Arial handles I post my answer; the font is loaded in anyway...

A command line alternative, which is only capable of listing them, is Handle; also written by Windows Sysinternals. You can also fetch a live version of it at http://live.sysinternals.com/handle.exe and use handle.exe followed by the sub string you want to search for.

Then use taskkill /PID 1234 /F /T where 1234 should be replaced by the PID of the process you got with Handle. Alternatively you can do it by image name with taskkill /IM instantbird.exe /F /T. Please note that /F forces termination and /T kills child prcoesses...


Here's my current workaround:

I stopped using Teracopy as my default copy handler (but I have not yet uninstalled it). After copying a folder, I would go into it, and then back out. Then I could rename it. Else, I would just have to wait a while.