This tip originally appeared on SearchWindowsServer.com, a sister site of SearchCIO-Midmarket.com.
Most administrators have at one time or another encountered a file that cannot be deleted or moved because it is in use.
Another tool that does this is Nir Sofer's OpenedFilesView (OFV). Most other tools in this arena work by having you right-click on the offending file and unlocking the file from a context menu. OFV doesn't work with any one file at a time, but instead produces a report of all the opened file handles in the system. The results can be sorted by filename, full path, handle, file attributes, file permissions, and information about the process holding locks on the file. If you are working with programs that may be holding a slew of files open at once, this is an easy way to find out what's keeping what open.
Right-clicking on any of the entries in the report gives you a context menu. From there you can force the file handle in question to close, kill the process holding the file open, or create an HTML report of the selected items. The program itself can also be run with command-line parameters to create HTML, XML or delimited text file reports, and can automatically close specified file handles (or even all the files held open in a given folder).
The program has a few drawbacks. Filenames and paths in Unicode are not yet enumerated correctly; non-ASCII characters show up as question marks. OFV also cannot close any files held open by the Windows kernel, due the APIs used (and also because that would most likely contribute to system instability).
Note: OFV can close files held open by Explorer.exe. Just make sure any Explorer windows that might actually be showing the file are already shut.
Serdar Yegulalp is editor of the Windows Power Users Newsletter.