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

WINDOWS SYSTEMS AND NETWORK 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 SearchWindowsServer.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
Perfmon made easy with PAL utility
Troubleshooting Windows application crashes or hangs
Free Windows security tools every admin must have
Top five Server Core management tips for Windows 2008
Top free tools for Windows server administration
A first look at Internet Information Services 7.0
Windows registry hack improves offline file access for mobile users
Reducing the size of network backups in Windows
Monitor network bandwidth with CyberGauge
How to format NTFS: More tricks to improve file system performance

Windows Systems and Network Administration
Troubleshooting Windows application crashes or hangs
Converting VMware ESX machines to Hyper-V format
Using DFSR for SYSVOL replication in Windows Server 2008
Top 25 Windows PowerShell commands for administrators
Key DFS improvements in Windows Server 2008 R2
Free Windows security tools every admin must have
Group Policy makes strides in Windows Server 2008 R2
Quick tips for troubleshooting NTFS permissions
Common causes of Windows server security vulnerabilities
Cutting the cost of Windows identity and access management

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.



Server Room Design - Planning, Cooling, Maintenance
HomeTopicsBlogsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




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