Openfiles

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

 

Openfiles

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

To view the command syntax, click a command:

  • openfiles disconnect

  • openfiles query

  • openfiles local

openfiles disconnect

Disconnects one or more open files.

Syntax

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

Parameters
  • /s Computer
    Specifies 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 Domain \ User
    Runs the script with the permissions of the specified user account. The default is system permissions.
  • /p Password
    Specifies the password of the user account that is specified in the /u parameter.
  • /id OpenFileID
    Disconnects 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 UserName
    Disconnects all open files by UserName value. The wildcard (*) can be used to disconnect all open files on the specified computer.
  • /o OpenMode
    Disconnects 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 OpenFileName
    Disconnects 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
  • Using the /s, /u, and /p command-line options The /u and /p command-line options are available only when you use /s. You must use /p with /u to provide the user's password.
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 documents\somedoc.doc"
openfiles /disconnect /session machine /id 5
openfiles /disconnect /s srvmain /u maindom\hiropln /id 5
openfiles /disconnect /s srvmain /u maindom\hiropln /p p@ssW23 /id *

openfiles query

Queries and displays all open files.

Syntax

openfiles /query [/s Computer [/u Domain**\User [/p** Password]]] [/fo {TABLE | LIST | CSV}] [/nh] [/v]

Parameters
  • /s Computer
    Specifies 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 Domain \ User
    Runs the script with the permissions of the specified user account. The default is system permissions.
  • /p Password
    Specifies the password of the user account that is specified in the /u parameter.
  • /fo format
    Specify 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.

  • /nh
    Suppresses column header in the output. Valid only when the /fo parameter is set to TABLE or CSV.
  • /v
    Specifies that detailed information be displayed in the output.
  • /?
    Displays help at the command prompt.
Remarks
  • Using the /s, /u, and /p command-line options The /u and /p command-line options are available only when you use /s. You must use /p with /u to provide the user's password.
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 maindom\hiropln /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

Formatting legend

Format Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

See Also

Concepts

Command shell overview
Command-line reference A-Z