The command line tool openfiles has been part of the Windows operating system for a long time. It basically can be used to display all system files that are currently opened by users of the same computer network. One of its applications is to analyze file access errors. It is for instance usually not possible to delete or modify a file if it is currently opened by another user on the network.
The openfiles tool requires administrative privileges, at least under Windows 7. This means that you need to start the command prompt with elevated rights. One way to do that is to click on the start orb, select All Programs and then Accessories. Right-click the command prompt entry and select Run as administrator from the context menu.
Enter openfiles and hit enter to run the command on the system.
Windows admins who are new to the command can use openfiles /? to display a list of available parameters:
OPENFILES /parameter [arguments]
Description: Enables an administrator to list or disconnect files and folders that have been opened on a system.
- /Disconnect Disconnects one or more open files.
- /Query Displays files opened locally or from shared folders.
- /Local Enables / Disables the display of local open files.
- /? Displays this help message.
As you can see from the parameters, it is not only possible to display all open files, but also to disconnect a user from your system. Lets say you need to access a file that is blocked by another user in the network. You can use the command openfiles /disconnect /ID xx to disconnect users. Just replace xx with the ID of the file that is shown in the open files listing.
It is furthermore possible to disconnect a user completely with the command openfiles /disconnect /a user where user is the name of the user that is currently accessing the files remotely.
Additional information about the commands can be accessed in the following way:
Disconnecting options include disconnecting all open file connections by names or modes. Wildcards are allowed to be used which means that the commands can be used to disconnect all users currently accessing files on the local system.Advertisement
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.