Home > Windows Systems Management Tips > Windows Systems Management and Administration > New Russinovich tool scans for open file references from command line
WinComputing Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

WINDOWS SYSTEMS MANAGEMENT AND ADMINISTRATION

New Russinovich tool scans for open file references from command line


Serdar Yegulalp, Contributor
11.07.2007
Rating: -4.00- (out of 5)


Expert advice on Windows-based systems and hardware
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


Serdar Yegulalp
I've written before about utilities that search for open file or directory processes and allow you to gracefully (or forcefully) close those connections. Most of these types of programs are friendly GUI-driven products that snap into Windows Explorer's right-click context menu. But I thought I'd talk about a recently updated tool that's (a) a command-line item and (b) written by someone who's created easily some of the best third-party add-on utilities for Windows as a whole.

I speak of Mark Russinovich and his command-line tool Handle, now in version 3.30. Handle 3.3 helps if you're trying to delete or move something and a program has stupidly left a handle open on a given file even if it's not actually doing anything with it. This functionality is also available through Russinovich's now-classic Process Explorer. But Handle repackages the handle-specific functions in a way that they can be used as part of a script or with better granularity than what you'd be able to get from the Process Explorer UI.

If you run Handle 3.3 without any command-line parameters, it'll simply dump out a list of all the open handles in the system -- which can be a very long list, so be warned. (Out of curiosity, I dumped out my own desktop's open-handles list to a text file and got a file 110K in size.)

If you use the -p switch in conjunction with a process name (a partial name is OK), you'll get a list of all the handles for all the processes that match that name. Each handle also has an associated hexadecimal ID, shown to the left of the filename. Example:

28A: File (---) D:\PORTAB~1.0\PORTAB~1\FIREFO~1\App\firefox\chrome\browser.jar

This file (dumped from a running instance of Portable Firefox, from the PortableApps collection) has a hex ID of 28A.

When you want to close a handle, use the -c switch to specify which handle, and you need to specify an exact process ID number with the -p switch. If I wanted to close this particular handle, I'd use the command line handle –c 28A –p 4056 (with 4056 being the process ID for Firefox here).

It's also possible to scan for handles by file rather than executable. If you specify a filename as the first argument for the program, you'll see all the processes that have that file open as a handle. Specify a directory and Handle will iterate through everything in the directory that has a handle open on it.

Keep in mind that terminating an open handle is always a slightly risky proposition. A program that doesn't accept such a thing gracefully may crash, and if you close an open handle on a system component, you can potentially hang the system up entirely.

Finally, note that you'll need administrative privileges to run Handle 3.3; in Vista, you can only run Handle from an elevated command prompt.

About the author: Serdar Yegulalp is editor of Windows Insight (formerly the Windows Power Users Newsletter), a blog site devoted to hints, tips, tricks and news for users and administrators of Windows NT, Windows 2000, Windows XP, Windows Server 2003 and Vista. He has more than 12 years of experience working with Windows, and contributes regularly to SearchWinComputing.com and other TechTarget sites.


Rate this Tip
To rate tips, you must be a member of SearchWinComputing.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
Windows Systems and Network Management Tools and Techniques
Reducing the size of network backups in Windows
Monitor network bandwidth with CyberGauge
How to format NTFS: More tricks to improve file system performance
Key enhancements to SCCM give admins more control over assets, licensing
Archiving information with New-Item in Windows PowerShell
More tips for preventing system startup issues in Windows XP
The new Microsoft System Center: What happened to SMS and MOM?
Application lifecycle management made simple with app virtualization
Identify file extension types with TrID
Windows System File Checker helps stop system failures

Windows Systems Management and Administration
Quick hits: Troubleshooting service account failure, batch job execution
Case Study: Troubleshooting Windows service dependency failures
Troubleshooting common Windows service failures
How to format NTFS: More tricks to improve file system performance
Key enhancements to SCCM give admins more control over assets, licensing
Windows scripting secrets for disk quota management
Optimizing NTFS file system performance
The new Microsoft System Center: What happened to SMS and MOM?
TeraCopy beefs up Windows file copy operations
Identify file extension types with TrID

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.

HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsWebcastsWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2004 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts