A network share can be created, configured, and deleted from the command line by using the net share command. Syntax and examples are provided below for the net share command.
The command-line method for creating a network share:
You can create a share using the following syntax.
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
The folder can be shared E:/Docs with all domain users and grant them full permission
net share Docs=E:\Documents /grant:everyone,FULL
The number of simultaneous accesses to a share can be limited if multiple users can access it simultaneously. The system will run more efficiently as a result. By running the following command, the limit will be increased to 10.
net share Docs=E:\Documents /grant:everyone,FULL /users:10
You can grant only read rights to a specific user by using the following command:
net share Docs=E:\Documents /grant:username,READ
The command line is used to remove a network share (i.e., to stop the folder from being shared)
net share sharename /delete
The share created above can be deleted by following these steps: for example, run the following command.
net share docs /delete
It is also possible to disable sharing by modifying the folder’s physical location.
net share E:\Docs /delete
List the shares that have been created on your local computer:
Shares on remote computers can be deleted:
net share sharename \\remotepc /delete
You may also like: Map Network Drive From Command Line [CMD]
Last Updated on 6 months by Max