Stop Sharing a Folder or Drive

Applies To: Windows 7, Windows Server 2008 R2

You can stop sharing a folder or drive by using the Shared Folders Microsoft Management Console (MMC) snap-in or by using a command prompt.

Important

Users connected to a shared folder are disconnected when you stop sharing it. Users may lose data if you stop sharing a folder containing an open shared file without warning. When possible, notify users before you stop sharing a folder.

Stop sharing a folder or drive

  • Using the Windows interface

  • Using a command line

To stop sharing a folder by using the Windows interface

  1. Open Computer Management. To do so, click Start, then right-click Computer, and then click Manage.

  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, then click Shared Folders, and then click Shares.

  4. In the details pane, right-click a shared folder, and then click Stop Sharing (this item only appears if you launched Computer Management using an account that is a member of the local Administrators group).

    To stop sharing multiple files, press the CTRL key while clicking the file names, right-click any one of the selected files, and then click Stop Sharing. This removes shared network access to the selected files.

To stop sharing a 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 share <sharename> /delete.
    

    For example, to stop sharing a folder called myshare, type:

    net share myshare /delete
    
Value Description

Net share

Creates, deletes, or displays shared folders.

<sharename>

The network name of the shared folder.

/delete

Stops sharing the folder.

Note

To view the complete syntax for this command, at the command prompt, type: net help share

Additional references

Command-line syntax notation