JSI Tip 7298. The Windows XP and Windows Server 2003 OpenFiles utility.

Jerold Schulman

October 7, 2003

3 Min Read
ITPro Today logo in a gray background | ITPro Today

When you use the Windows XP CMD help., or Windows Server 2003 CMD help, and press Openfiles on the New command-line tools page, you see:

Openfiles

Queries, displays, or disconnects open files or files opened by network users. Also enables or disables the system Maintain Objects List global flag.

openfiles disconnect

Disconnects one or more open files.

Syntax

openfiles /disconnect [/s Computer [/u DomainUser [/p Password]]] {[/id OpenFileID] | [/a UserName] | [/o OpenMode]} [/op OpenFileName]

Parameters

/s ComputerSpecifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer. This parameter applies to all files and folders specified in the command./u DomainUserRuns the script with the permissions of the specified user account. The default is system permissions./p PasswordSpecifies the password of the user account that is specified in the /u parameter./id OpenFileIDDisconnects the file opened with the specified numeric OpenFileID on the computer specified by the /s parameter. Use openfiles /query to learn the file ID. The wildcard (*) can be used to disconnect all open files on the specified computer./a UserNameDisconnects all open files by UserName value. The wildcard (*) can be used to disconnect all open files on the specified computer./o OpenModeDisconnects all open files by OpenMode value. OpenMode values are Read, Write or Read/Write. The wildcard (*) can be used to disconnect all open files on the specified computer./op OpenFileNameDisconnects all open file connections created by a specific OpenFile name. The wildcard (*) can be used to disconnect all open files on the specified computer./?Displays help at the command prompt.

Remarks

  • XOX

Examples

The following examples show how you can use the openfiles /disconnect command:

openfiles /disconnect /id 1
openfiles /disconnect /a hiropln
openfiles /disconnect /o read/write
openfiles /disconnect /op "c:my documentssomedoc.doc"
openfiles /disconnect /session machine /id 5
openfiles /disconnect /s srvmain /u maindomhiropln /id 5
openfiles /disconnect /s srvmain /u maindomhiropln /p p@ssW23 /id *

openfiles query

Queries and displays all open files.

Syntax

openfiles /query [/s Computer [/u DomainUser [/p Password]]] [/fo {TABLE | LIST | CSV}] [/nh] [/v]

Parameters

/s ComputerSpecifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer. This parameter applies to all files and folders specified in the command./u DomainUserRuns the script with the permissions of the specified user account. The default is system permissions./p PasswordSpecifies the password of the user account that is specified in the /u parameter./fo formatSpecify the output format with one of the following values:

Value

Description

Table

Displays output in a table.

List

Displays output in a list.

Csv

Displays output in Comma Separated Values format.

/nhSuppresses column header in the output. Valid only when the /fo parameter is set to TABLE or CSV./vSpecifies that detailed information be displayed in the output./?Displays help at the command prompt.

Remarks

Examples

The following examples show how you can use the openfiles /query command:

openfiles /query
openfiles /query /fo table /nh
openfiles /query /fo list /v
openfiles /query /s srvmain /u maindomhiropln /p p@ssW23

openfiles local

Enables or disables the system Maintain Objects List global flag.

Syntax

openfiles /local [{on | off}]

Parameters

{on | off}Enables or disables the system Maintain Objects List global flag, which tracks local file handles. Changes made by this switch will take effect only after restarting the system./?Displays help at the command prompt.

Remarks

  • Enabling the Maintain Objects List global flag may slow down your system.

Examples

To check the current status of the Maintain Objects List global flag, type:

openfiles /local

To enable the Maintain Objects List global flag, type:

openfiles /local on

To disable the Maintain Objects List global flag, type:

openfiles /local off



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like