Skip to content

Instantly share code, notes, and snippets.

@kekru
Last active August 27, 2021 02:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kekru/bfc57c40a23b03058f4853d7e04b8112 to your computer and use it in GitHub Desktop.
Save kekru/bfc57c40a23b03058f4853d7e04b8112 to your computer and use it in GitHub Desktop.
Windows: Find process locking a file or directory

Find and stop process locking file on Windows

  • Download Handle
    or install with chocolatey:
    choco install -y handle
  • Print all file handles in a file:
    handle > handles.log
  • Find the process in handles.log (e.g example.exe) and stop it with Powershell:
    Stop-Process -Name example

As an alternative, you could use the GUI tool Process Explorer (-> choco install -y procexp) and search your locked file with Ctrl+F

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment