≡ Menu

Net share command: List / create / delete network shares from command line

We can use net share command to create, setup, list and delete network shares from command line . Below you can find syntax and examples for net share command.

Setup shared folder from command line

The syntax for sharing a folder is as follows.

net share sharename=folderpath /grant:username,permissions

sharename : You can assign name to the share you are going to create
username : Login id of the user whom you want to share the folder with
permission: Read, Change or Full
For example to share the folder E:\Docs with everyone in the domain and to give full permissions

net share Docs=E:\Documents /grant:everyone,FULL

If you are allowing multiple users to access the share, you can limit the number of users accessing the share simultaneously. This will prevent high load on your system. The below command will set the limit to 10 users.

net share Docs=E:\Documents /grant:everyone,FULL  /users:10

Command to share folder with a specific user and to grant only read rights:

net share Docs=E:\Documents /grant:username,READ

Delete network share(i.e to disable sharing of the folder) from command line

net share sharename /delete

For example, to delete the share created above, the command would be as below.

net share docs /delete

Alternatively, we can use the folder physical location also to disable sharing

net share E:\Docs /delete

List all the shared folders on the computer

Run the below command

net share

Example:

C:\>net share
Share name   Resource                        Remark
-------------------------------------------------------------------------------
C$           C:\                             Default share
IPC$                                         Remote IPC
ADMIN$       C:\WINDOWS                      Remote Admin
The command completed successfully.

Delete the share on a remote computer

net share sharename \\remotepc /delete
6 comments… add one
  • SeanH

    the grant option does not work in windows xp.

  • John Thayer Jensen

    Is there any way on the command line to CREATE a share on a remote computer?

    jj

    • tendy

      you could use winrs

  • Chris

    Need to know how to delete a user name from the share permissions list (not delete the share)

  • sk

    How to list out the shared drive users. What command is there to view the users of the shared drive in command line.?

  • Francisco Castro

    You need to use for /grant:username,READ ==>> /grant:”username,READ”, this last works fine

Leave a Comment