Join Us!

Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.
A valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.

Login

Enter your Project Envision username.
Enter the password that accompanies your username.
Request new password

Share Folder From Command Line in Windows

I often hear that Windows is a bad operating system, because you have to do everything from GUI, I totally disagree with such a statement. Windows has many very useful tool in its command line interface. Not to mention Power Shell, in which you can script almost everything. In that blog post I will present a quick How-To on sharing a folder from command line.

Display Shares

To share a folder from command line we use net share command. By simply typing net share command, we will be returned the list of all shares in the system.

C:\Users\KrystianZieja\Documents>net share

Share name   Resource                        Remark

-----------------------------------------------------------------------
C$           C:\                             Default share
IPC$                                         Remote IPC
ADMIN$       C:\Windows                      Remote Admin
The command completed successfully.

Sharing a folder

To share a folder we have to use net share with providing share name and path to disk resources

c:\Users\KrystianZieja\Documents>net share testShare=C:\Users\KrystianZieja\Docu
ments\test
testShare was shared successfully.

c:\Users\KrystianZieja\Documents>net share

Share name   Resource                        Remark

-------------------------------------------------------------------------------
C$           C:\                             Default share
IPC$                                         Remote IPC
ADMIN$       C:\Windows                      Remote Admin
testShare    C:\Users\KrystianZieja\Documents\test

The command completed successfully.

Advanced Sharing

Using net share command we can also set permissions on a share we are creating, like in the example below. Instead of CHANGE, we can use READ or FULL.

c:\Users\KrystianZieja\Documents>net share test2=C:\Users\KrystianZieja\Document
s\test2 /GRANT:MBOOK\alien,CHANGE
test2 was shared successfully.

Share Properties

The command net share also allows us to setup maximum users per share and add share commands.

c:\Users\KrystianZieja\Documents>net share

Share name   Resource                        Remark

-------------------------------------------------------------------------
C$           C:\                             Default share
IPC$                                         Remote IPC
ADMIN$       C:\Windows                      Remote Admin
test2        C:\Users\KrystianZieja\Documents\test2

testShare    C:\Users\KrystianZieja\Documents\test
                                             My Test Comment

Deleting Shares

To delete a share using net share we use the following syntax: net share shareName /delete

c:\Users\KrystianZieja\Documents>net share test2 /delete
test2 was deleted successfully.


c:\Users\KrystianZieja\Documents>net share testShare /delete
testShare was deleted successfully.


c:\Users\KrystianZieja\Documents>net share

Share name   Resource                        Remark

--------------------------------------------------------------
C$           C:\                             Default share
IPC$                                         Remote IPC
ADMIN$       C:\Windows                      Remote Admin
The command completed successfully.

Categories: