Windows – How to close all file handles under a given folder programatically

windows

I was wondering if there is a command-line tool that allows me to close all file handles that are open under a specific folder.

I have tried ProcessExplorer, Unlocker and similar tools, but they offer a GUI interface, and are not useful in a programming environment

A solution on Python, cmd or PowerShell would be ideal.

Best Answer

Unlocker does claim it gives you this ability:

  1. Simply right click the folder or file and select Unlocker

    Step1

  2. If the folder or file is locked, a window listing of lockers will appear

    Step2

  3. Simply click Unlock All and you are done!

I'm not sure if it supports command-line usage.

MalwareByte's FileAssassin performs similar actions, and does support command-line usage, so you should be able to script it pretty easily.

FileAssassin's Switches

Related Question