This tip was printed from the MalekTips Computer and Technology Help and Tips website at http://malektips.com.
SUMMARY: Display the list of files opened by running processes in Windows XP.
There is often a need to determine which process has opened a particular file in Windows XP. One such example is when you are unable to delete, rename, or edit a file because Windows claims the file is opened by another process. This dialog often does not say which process has access to a file, only that the file is locked.
To help determine which process currently has exclusive rights to a particular file, you can download a command appropriately named handle from the Sysinternals site, part of Microsoft Technet.
Simply download the zip file Handle.zip, unzip the contained executable to your main Windows directory, and you can display all open file handles with the following command:
handle
The results (which you should either pipe to more or to an external file because there will be several pages) will show each open process followed by the handles opened by said process. If you want to match up process IDs (PIDs) to processes shown in the Windows Task Manager:
1. From the Windows Task Manager, select "View" - "Select Columns".
2. When the "Select Columns" dialog box appears, check "PID (Process Identifier)".
3. Click "OK" to close the "Select Columns" dialog box.
If you want to display other open handle types including Registry keys and threads, add the -a option:
handle -a
Use the -p option to limit shown handles to those of a process name matching what you desire. For example, to show all open file handles of all Notepad processes, issue this command:
handle -p notepad
If you want to know which process has a particular file or other object opened, just add part of the filename after the command. For example, to find any processes that are currently accessing files containing the name or path of Rhapsody, issue this command:
handle rhapsody
Other options:
-c
Close the handle specified by a following hexadecimal number. Note that this can cause software or your operating system to crash, with possible loss of file information.
-y
Do not prompt when closing a handle mentioned when using the -c option.
-l
When used with the -a option, shows pagefile-backed section handles.
-s
Displays a count of the types of handles opened, including ports, directories, events, files, threads, timers, and processes.
-u
When searching for which process has a particular open file or other object, this will add the username in which the process is running.
* Download Sysinternals Handle
Press the "print" button on your browser or select "File" - "Print" to print this tip. Then, return to Windows XP and DOS - See Which Process Has Opened a File or Other Object
Standard disclaimer applies - read http://malektips.com/disclaim.html