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

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 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

  • 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 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 [email protected] /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

    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 [email protected]

    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



    Hide comments

    Comments

    • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

    Plain text

    • No HTML tags allowed.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs break automatically.
    Publish