The simplest way to share folders is through Windows Explorer and in almost every environment this is a common practice, however, Server core installations are getting more popular in virtualized environments. In case, you need to upload some files to a server core installation, the net share command may save your day! To view any existing shares on your machine you can just type net share, but this command is far more powerful:
net share sharename=drive:path [/grant: user, [read | change | full]] [/cache: manual | documents | programs | none]
Where sharename is the name that the users will see when connecting to the folder and the grant parameter allows you to specify a user or a group together with the allowed access permissions. The cache option allows you to define Offline Files for document or applications. For complete usage information, type: net share /?
Now, let's consider some examples. For example, to share the Data folder residing in the d: drive using the share name Sales, from an elevated command prompt type:
net share Sales=d:\data
And to share the same folder while setting read-only access permissions and disallowing Offline Files, type the following command:
net share Sales=d:\data /grant:everyone,read /cache:none
And to remove the above share, simply type:
net share Sales /delete
On the other hand, if you need to connect to the above share from a client workstation or from a server core installation to shared folder you need to use the net use command and the UNC (Universal Naming Convention) format for the share location. The UNC format syntax is \\<server name>\<share name>.
When connecting to shares, you can specify a local drive as if the network share appears to be a local volume or drive. Therefore, shared network folders can be mapped to local drives and you can accomplish this by typing:
net use z: \\MyServer\Sales
Where z: is the local drive that corresponds to a shared folder (Sales) on MyServer. Therefore, Z: becomes the mapped network drive.