Net share

 

Applies To: Windows Server 2008, Windows 7, Windows Server 2008 R2, Windows Server 2012, Windows 8

Manages shared resources. Used without parameters, net share displays information about all of the resources that are shared on the local computer. For each resource, the device name(s) or pathname(s) and a descriptive comment are displayed.

For examples of how to use this command, see Examples.

Syntax

net share <ShareName>
net share <ShareName>=<drive>:<DirectoryPath> [/grant:<user>,{read | change |full}] [/users:<number> | /unlimited] [/remark:<text>] [/cache:{manual | documents | programs | BranchCache |none} ]
net share [/users:<number> | /unlimited] [/remark:<text>] [/cache:{manual | documents | programs | BranchCache |none} ]
net share {<ShareName> | <DeviceName> | <drive>:<DirectoryPath>} /delete
net share <ShareName> \\<ComputerName> /delete

Parameters

Parameter

Description

<ShareName>

Specifies the network name of the shared resource. Type net share with a ShareName to display information about that share only.

<drive>:<DirectoryPath>

Specifies the absolute path of the directory to be shared.

/grant:<user>,{read | change |full}

Creates the share with a security descriptor that gives the requested permissions to the specified user. The permissions that can be granted to a user are: read, change or full. This option may be used more than once to give share permissions to multiple users.

/users:<number>

Specifies the maximum number of users who can simultaneously access the shared resources.

/unlimited

Specifies an unlimited number of users can simultaneously access the shared resources.

/remark: <text>

Adds a descriptive comment about the resource. Enclose the text in quotation marks.

<DeviceName>

Specifies one or more printers (LPT1: through LPT9) shared by ShareName.

/delete

Stops sharing the resource.

/cache: manual

Enables manual client caching of programs and documents from this share.

/cache: documents

Enables automatic caching of documents from this share.

/cache: programs

Enables automatic caching of documents and programs from this share.

/cache: BranchCache

Enables manual caching of documents with Branch Cache enabled from this share.

/cache: none

Disables caching from this share.

net help <command>

Displays help for the specified net command.

Remarks

  • To share a directory with a path that contains a space, enclose the drive and the path of the directory in quotation marks (for example, “C:\Path Name” 

  • When you display all the shared resources on a computer, the share name of each resource, the device names or path that are associated with the resource, and a descriptive comment about the resource appear. The output is similar to the following:

    Share name   Resource                        Remark
    
    -------------------------------------------------------------------------------
    ADMIN$       C:\windows                      Remote Admin
    C$           C:\                             Default share
    CCMLOGS$     C:\windows\CCM\Logs             Public Share
    ccmsetup$    C:\windows\ccmsetup             Public Share
    IPC$                                         Remote IPC
    public       C:\public
    Users        C:\Users
    The command completed successfully.
    
  • As you create shares on a server, they are saved. When you stop the Server service, all shares are disconnected, but they are reconnected automatically when the computer is restarted. For more information about services, see Related Topics.

  • Shared resource names that end in a $ character do not appear when you browse the local computer from a remote computer. For more information, see Additional References.

Examples

To display information about shared resources on the local computer, type:

         net share       

To share a computer's C:\Data directory with the share name DataShare and include a remark, type:

         net share DataShare=c:\Data /remark:"For department 123."       

To stop sharing the DataShare folder you created in the previous example, type:

         net share DataShare /delete       

To share a computer's C:\Art List directory with the share name List, type:

         net share list="c:\Art List"       

Additional references

Command-Line Syntax Key

Net services overview

Special shared resources

Services

Shared Folders Concepts