NET SHARE command
NET SHARE command
NET SHARE is used to manage shared resources. NET SHARE creates, deletes, modifies, or displays shared resources. This command is used to make a resource available to clients.
This command needs to be run as root or an account that has the proper privileges to share resources, so to avoid any complications, it is best to use the Administrator account.
How to quickly view all shared folder on my computer?
You can use the NET SHARE command without parameters to get this information. When using the NET SHARE command without parameters, NET SHARE displays information about all of the resources that are shared on the local computer.
Go to the Start menu, click Run, type cmd, and hit ENTER. Then type NET SHARE, and you will get a screen similar to the following:
Share name Resource Remark
-------------------------------------------------------------------------------
D$ D:\ Default share
R$ R:\ Default share
ADMIN$ C:\WINNT Remote Admin
wwwroot$ c:\inetpub\wwwroot Used for file share access to web
C$ C:\ Default share
IPC$ Remote IPC
The command completed successfully.
Executing the NET SHARE command without parameters gives you a listing of all the folders that are shared on your computer.
Note, the INETPUB\WWWROOT is your IIS webserver root folder.
Shared resource names that end in a $ character do not appear when you browse the local computer from a remote computer. If you want to access this folder from the remote computer, you have to type an exact path into your Explorer on the computer from which you connect to the shared folder.
How do I get detailed information about a shared local folder?
If you need detailed information about a particular shared folder, execute the NET SHARE folder with the name of the shared device, for example NET SHARE C$. You will get an output of the NET SHARE command similar to the following:
Share name C$These parameters, such as the maximum number of users who can simultaneously access the shared resource, can be modified by the NET SHARE command too. See the explanation of parameters for the NET SHARE command below.
Path C:\
Remark Default share
Maximum users No limit
Users
Caching Manual caching of documents
The command completed successfully.
How do I share a folder?
To create a new local file share, use the following NET SHARE command:
NET SHARE sharename=drive:path /REMARK:"My shared folder" [/CACHE:Manual | Automatic | No ]
This is what it would look like in the real world:
NET SHARE MySharedFolder=c:\Documents /REMARK:"Docs on server ABC"
By executing this command, you would make the Documents folder on the C drive available for others in the network.
How do I limit how many users can access my shared folder?
To limit the number of users who can connect to a shared folder, you would use the following NET SHARE command:
NET SHARE sharename /USERS:number /REMARK:"Shared folder with limited number of users"
To remove any limit on the number of users who can connect to a shared folder, use the following:
NET SHARE sharename /UNLIMITED /REMARK:"Folder with unlimited access"
This will allow unlimited number of users to connect to the shared resource.
How do I remove sharing from a folder?
You can accomplish this using the following NET SHARE command again. If you want to delete a share, then execute the following:
NET SHARE {sharename | devicename | drive:path} /DELETE
To delete all shares that apply to a given device, you would use the following:
NET SHARE devicename /DELETE
In this case the devicename can be a printer (Lpt1) or a pathname (for example C:\MySharedFolder\).
Possible problems with NET SHARE syntax
In case your folder or server name contains a space, you need to enclose the drive and the path of the directory in quotation marks (for example, "C:\MySharedFolder"). Not providing quotation marks results in an error message: System error 85 has occurred.
System errors related to NET SHARE
When using the NET SHARE command, you can run into some syntax-related errors. The System error 67 occurred is a very common one. See here for more details: System error 67 has occurred.
Are there other related useful networking commands?
The NET SHARE command is used at the server to share a folder to others. If you want to access this shared resource from a client, you would use the NET USE command.
This page provides an overview of all available networking server commands: server NET commands.
NET SHARE syntax
net share [ShareName]
net share [ShareName=Drive:Path
[{/users:Number | /unlimited}]
[/remark:"Text"]
[/cache: {manual | automatic | no}]
]
net share [ShareName
[{/users:Number | unlimited}]
[/remark:"Text"]
[/cache: {manual | automatic | no}]
]
net share [{ShareName | Drive:Path} /delete]
What are the parameters?
ShareName
Specifies the name of the shared resource as it should display on the network.
Drive:Path
Defines the absolute path of the directory to be shared.
/remark:"Text"
Adds a description about the resource. Do not forget to enclose it in quotation marks.
/users:Number
Used to set the maximum number of users who can simultaneously access the shared resource.
/unlimited
This setting specifies an unlimited number of users who can simultaneously access the shared resource.
/cache:manual
Enables offline client caching with manual reintegration.
/cache:automatic
Enables offline client caching with automatic reintegration.
/cache:documents
Enables automatic caching of documents from this share.
/cache:programs
Enables automatic caching of documents and programs.
/cache:no
Disables caching.
/delete
Stops sharing the shared resource.
net helpCommand
Displays Help for the specified net command.
It is easy, just include the code provided below into your HTML code.