Releasing Windows file share locks Releasing Windows file share locks windows windows

Releasing Windows file share locks


If you are admin on the server sharing the file over the network, you can use the Windows in-built feature:

  1. Start → My Computer → Right-click → Manage gets you to the ComputerManagement console
  2. In the left nav, navigate to Systems Tools → Shared Folders
  3. You can view Shares, Sessions & Open Files here. This allows you to find out who has opened which files from which workstations.
  4. Right-click on an item in the list to be able to remove the file lock.

Hope this helps.


Found a solution.

  1. Find the process using Process Explorer:

    1. Download and extract procexp.exe
    2. In Process Explorer use the "Find Handle or DLL..." command from the "Find" menu
    3. Enter in the name of the directory which is having trouble deleting
    4. A list of open files which match that name should be shown. Take some guesses and find which one is failing to be deleted. If the file is locked by a windows share, the process holding the file will be System
    5. Note down the directory which was left open
  2. Download and install the Unlocker (Warning: Link removed, as it contains malware)

    1. Install Unlocker, disabling the option for Explorer extensions and other junk
  3. Unlock the directory

    1. Open up a cmd window, and navigate to C:\Program Files\Unlocker
    2. From the cmd window, run Unlocker.exe "the-path-to-the-locked-folder"
    3. A dialog will pop up confirming the lock release. Use the unlock button to unlock the file

Now the directory should be unlocked, and can now be deleted.


Try Process Hacker:https://wj32.org/processhacker/

Process hacker is like Process Explorer on steroids.

To find the offending process, press CTRL+F or click the "Find Handles of DLLs" button and search for the file name.

Once you find the file in the find handles dialog, you can simply right click the file there and choose "close". (at least for v2.39.124)

Older versions had a "terminator" option in the context menu of the process. Right click on the offending process --> Miscellaneous --> Terminator --> Select termination techniques. Note that some are possibly dangerous and may have unintended consequences.