Handle (Sysinternals)

Handle v4.22 1 — search mode (enabled by specifying a name fragment as a parameter)

if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

Unlock a file handle locked by SYSTEM or any other active process 2

Handle64.exe > output.txt

How to unlock file locked by SYSTEM or app process 3

Handle64.exe -a "C:\Program Files\App"
handle64.exe -p excel.exe
Handle.exe -a C:\Path\To\Resource\That\Is\Locked\Open > Output.txt
handle.exe -c <handleID> -p <processID>

Sysinternals Handle tutorial 4
Unlock-File.ps1 5
Unlock file handle gist 6

< «