查看本机被远程打开的共享文件并断开
局域网里谁开着你的共享文件?openfiles /query 一目了然,还能按 ID 强制断开。
在管理员终端运行 `openfiles /query /fo table` 列出被远程打开的文件,再运行 `openfiles /disconnect /id <编号>` 断开指定文件。
01命令
命令
$ openfiles /query /fo table
# disconnect a specific open file by ID:
openfiles /disconnect /id 123402作用说明
在家庭或办公室网络中共享文件夹时,别人可能正占用你的文件,这也是文件有时无法移动或删除的原因。Windows 可以跟踪这些被打开的对象,openfiles 命令负责报告:/query 会列出每个被远程打开的文件及其访问方式和编号。注意:需要先用 openfiles /local on 开启本地跟踪并重启一次,列表才会有内容;之后还可用 /disconnect 强制关闭某个文件。
03风险
!注意: 对方正在保存文档时强制断开,可能导致其文件保存不完整——动手前先和同事打个招呼。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- Openfiles - List or Disconnect Open Files - SS64依据: Documents /query listing remotely opened files and /disconnect closing them by ID or name.
- openfiles command | Microsoft Learn依据: openfiles /query lists files opened from the local system by remote users; openfiles /disconnect /id <id> disconnects a specific open file.
最后验证: 2026-09-19 · 分类: 文件与文件夹