openfiles and how to close
- Details
- Category: Batch
- Created: Wednesday, 20 August 2014 07:16
- Last Updated: Friday, 10 November 2017 17:39
- Published: Wednesday, 20 August 2014 07:16
- Written by Frank
- Hits: 9385
How to list open files via Batch command and how to close specified open files on a share
openfiles | find /i "\bin\debug"
Output:
183 USER1 Windows C:\..\bin\Debug
...
Close all open files on a specified path:
FOR /F %i in ('openfiles^|find /i "bin\debug"') Do openfiles /disconnect /id %i
Or close all open files for a specified user id:
openfiles /disconnect /a USER1