Who/What Has That File Open?
Last Updated: 23 May 2003
*** PLEASE NOTE: Link(s), If Provided, May Be Wrapped ***
One of the more annoying situations you can run across is
trying to delete or move a file, only to be told that it
"IS IN USE". Unfortunately, the default tools in NT/2000
are woefully inadequate to tell you who or what has that
file or folder open.
• NET FILE ............... Native Utility
• OPENFILES .............. Native Utility (XP/2003)
• PSFILE ................. http://technet.microsoft.com/en-us/sysinternals/bb545027.aspx
• HANDLE ................. http://technet.microsoft.com/en-us/sysinternals/bb545027.aspx
• FILE MANAGER ........... Native Utility
• SERVER MANAGER ......... Native Utility
• PROCESS EXPLORER ....... http://technet.microsoft.com/en-us/sysinternals/bb545027.aspx
• TASKINFO ............... http://www.iarsn.com/download.html
In NT4, you were able to use File Manager (or Server
Manager) to determine who or what was using the file in
question. There were many situations, however, where the
information provided was not accurate.
Besides the NET FILES command which is available in all
versions of Windows, Windows XP and 2003 provide a native
utility (in the way of a VBS script) that will accurately
list all open files on a local or remote system:
To *accurately* determine what service or process may be
holding on to a file, use NTHANDLE, PROCESS EXPLORER or
PSFILE from the ever-useful SysInternals website, or
TaskInfo, a handy shareware utility.
FINDING THE OPEN FILE HANDLES
Download HANDLE.EXE and PSTOOLS (listed above) and place
them in C:\UTILS
Next, open a Command Prompt (START -> RUN -> CMD) and
type the following commands exactly as they appear below:
FOR %V IN (HANDLES OPENFILES) DO NOTEPAD C:\%V.INFO
Once you've determine what process is holding on to
the file, Stop (or kill, as appropriate) the process.
In the event that the process in question is SYSTEM,
you will have to reboot before you can get control of
the file (it might even go away after the reboot).
In some extreme cases, you might need to run CHKDSK,
but 9 times out of 10, I haven't had to do that.
WHITEPAPERS & TECH DOCUMENTS
• In Windows 2000, you can use the "Shared Folders"
MMC Snap-In to see a list of Open Files and other
file/folder usage info. I still prefer the tools
• To access remote Shared Folders in Windows 2000
(assuming appropriate permissions):
- Right Click on "My Computer"
- Select "Manage"
- Right Click on "Computer Management"
- Select "Connect to Another Computer"
- Select "System Tools"
- Select "Shared Folders"
• If you determine that the file is held by any process
other than SYSTEM, you can just stop the appropriate
service, close the relevant app or kill the process,
and you should gain access to the file. If it's
SYSTEM, then you have to reboot.
• If you're forced to reboot, and even that is not
helpful -- including safe mode -- then you should
schedule a CHKDSK (CHKDSK C: /F) and reboot.
RELATED SCRIPTS (ALSO IN THIS ARCHIVE)
RELATED TOPICS (ALSO IN THIS ARCHIVE)