See Which Shared Files Are Open on Your PC (and Disconnect Them)
List every file that other computers on the network have opened on your shared folders with openfiles /query, and cut a session with /disconnect.
01Command
$ openfiles /query /fo table
# disconnect a specific open file by ID:
openfiles /disconnect /id 123402What it does
If you share folders on a home or office network, other people may hold files open without you knowing — which is why a file sometimes refuses to move or delete. Windows can track these objects, and the openfiles command reports them: /query lists each remotely opened file with its access mode and an ID number. Before the list shows anything, tracking must be enabled once with openfiles /local on plus a reboot; afterwards you can also forcibly close a file with /disconnect.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Openfiles - List or Disconnect Open Files - SS64Evidence: Documents /query listing remotely opened files and /disconnect closing them by ID or name.
- openfiles command | Microsoft LearnEvidence: openfiles /query lists files opened from the local system by remote users; openfiles /disconnect /id <id> disconnects a specific open file.
Last verified: 2026-09-19 · Category: Files & Folders
06Related solutions
Two-step command sequence that makes you the owner of a locked file tree and grants yourself full control — the standard fix for 'Access is denied' on old profiles and OS reinstall leftovers.
Built-in Windows command to compute MD5, SHA1 or SHA-256 hashes of any file.
Windows' built-in tool for overwriting freed disk clusters so previously deleted files can't be recovered — no third-party shredder needed.