Net file

Displays the names of all open shared files on a server and the number of file locks, if any, on each file. This command also closes individual shared files and removes file locks. Used without parameters, net file displays a list of the open files on a server.


net file [ID [/close]]


ID   : Specifies the identification number of the file.

/close   : Closes an open file and releases locked records. Type this command from the command prompt on the server where the file is shared.

net help   command   : Displays help for the specified net command.


  • You can also type net files to run this command.

  • Use net file to view and control files shared on the network. Sometimes, a user leaves a shared file open and locked by mistake. When this happens, other computers on the network cannot gain access to the locked portions of the file. Use net file /close to remove the lock and close the file. Net file output is similar to the following:

    File      Path             Username    #locks
    0         C:\A_FILE.TXT    MARYSL      0
    1         C:\DATABASE      DEBBIET     2


To view information about shared files, type:

net file

To close a file that has the identification number 1, type:

net file 1 /close

Formatting legend




Information that the user must supply


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

Net services overview

Command-line reference A-Z