In large or small organizations, the use of shared storage is common practice, or allowing several users access to files in each others computers.
The command below does just that, by displaying the currently mapped drives.
net use
To map a shared file or drive with a random drive letter:
net use * \\Remote-Computer-Name\Share-Path
For a single time connection. Its possible to use drive letters D: through Z:.
net use * \\Remote-Computer-Name\Share-Path /persistent:yes
To save the settings, and keep the drive mapped after a reboot.
If credentials are needed:
net use * \\Remote-Computer-Name\Share-Path P@$$w0rd /user:%domain%\%username%
To map the drive with the currently logged in domain and user. Replace
P@$$w0rd with the user password.
net use * \\Remote-Computer-Name\Share-Path P@$$w0rd /user:%domain%\%username% /savecred /persistent:yes
To map the drive with the currently logged in domain and user, but keep them mapped after a restart.
Sometimes it might also be required to share files directly between user’s computers. Often this option disabled by Group Policy. In that case command below helps if Command Prompt is launched as administrator:
netsh advfirewall firewall set rule group=”Network Discovery” new enable=Yes
Then to map the drive the command is:
net use * \\computer-name\drive:\path$ P@$$w0rd /user:username
ex: net use f: \\Computer1\c:\folder$ Password /user:user /savecred /persistent:yes
/savecred /persistent:yes