You can close shared files or folders by using the Shared Folders Microsoft Management Console (MMC) snap-in or by using a command prompt.

Important

Users connected to a shared file or folder are disconnected when you close it. Users may lose data if you close an open shared file without warning. When possible notify users before closing files and disconnecting them.

Closing an open file

To close an open shared file or folder by using the Windows interface
  1. Open Computer Management.

  2. If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Yes.

  3. In the console tree, click System Tools, click Shared Folders, and then click Open Files.

  4. Do one of the following:

    • To close all open files and folders, on the Action menu, click Disconnect All Open Files.

    • To close a specific file or folder, in the Results pane right-click the file or folder name, and then click Close Open File.

    • To disconnect multiple open files or folders, press the CTRL key while clicking the file or folder names, right-click any one of the selected files or folders, and then click Close Open File. This closes the selected files or folders.

To close an open shared file or folder by using a command line
  1. To open an elevated Command Prompt window, click Start, point to All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.

  2. If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Yes.

  3. Type:

    net file <ID> /close
    

    For example, to close an open file identified as myfile_id, type:

    net file myfile_id /close
    

Value Description

Net file

Displays the names of all open shared files or folders on a server and the number of file locks, if any, on each file or folder.

<ID>

The dynamically assigned ID of the shared file or folder.

/close

Closes the shared file or folder and removes file locks. Type this command from the server where the folder is shared.

Notes
  • To view the complete syntax for this command, at the command prompt, type: net help file
  • To see the file ID of the shared file or folder, type net file

Additional references