Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a shared folder from the Windows command line?

Tags:

As far as I'm aware, this is done via the net command.

However, the help section isn't very helpful, as it only shows me the secondary options and not how to use those.

Suppose I had a folder C:\Share_test

How would I make it shared from the command line?

like image 257
KdgDev Avatar asked Oct 08 '09 10:10

KdgDev


People also ask

How do I create a shared folder in Command Prompt?

Launch Command Prompt as administrator. Create folder if not already exist. Share folder using net command. C:\>net share mysharedfolder=c:\shared mysharedfolder was shared successfully.

What is the command to create a share?

Creating a Share using Net Share The most basic of commands simply creates the share and assigns a share name. For example: C:\Windows\system32>net share MyFolder=c:\users\bill\MyFolder MyFolder was shared successfully.


2 Answers

Using the "net help share" command you will see that the syntax is as follows:

net share sharename=drive:path 

For example, if I had a folder S:\Public which I wanted to share as "Public" the command would be:

net share Public=s:\Public 

The above command will automatically grant "Everyone" with Read permissions only. If you want to grant Everyone with Full Control the command would be:

net share Public=s:\Public /GRANT:Everyone,FULL 

Keep in mind that NTFS permissions still apply, so even though you might have granted EVERYONE with FULL access to the share, you'll still have to check the NTFS security permissions to ensure that the right people have permission there too.

like image 69
Dave Lucre Avatar answered Sep 18 '22 13:09

Dave Lucre


C:\> net help share

For example:

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."

like image 43
Sinan Ünür Avatar answered Sep 19 '22 13:09

Sinan Ünür