Network Administration: Net File Command - dummies

Network Administration: Net File Command

The Windows Server 2008 Net File command lists all open shared files and the number of file locks placed on each file. You can also use this command to close files and remove locks, which is a useful procedure when a user manages to accidentally leave a file open or locked. Here’s the syntax:

C:>net file [id [/close]]

The following paragraphs describe the Net File command’s parameters:

  • ID: The file’s identification number.

  • Close: Closes an open file and releases any locks that were placed on the file.

To close a file, you must issue the command from the server where the file is shared.

Net Files works, too.

To close an open file, first run Net File without any parameters to list the open files. Here’s a sample of the output that you can expect from Net File:

File      Path             Username    #locks
0         C:BUDGET.DOC    WARD        0
1         C:RECIPE.MDF    JUNE        4

Next, run Net File again, specifying the file number displayed for the file that you want to close. For example, to close the RECIPE.MDF file, use this command:

C:>net file 1 /close