To map a network drive from the command prompt we have to use the net use command. If you already know the UNC path to your share, then you’re good to go–the following command will map the movies share to the S drive.
net use s: \\tower\movies
Your share will probably be protected with some sort of authentication, and the user switch allows us to specify a username and password. The following example assumes:
The username you authenticate with on the remote machine is HTG
The password for the HTG account is Pa$$word
net use s: \\tower\movies /user HTG Pa$$word
The previous commands are not persistent, this means that the minute you reboot your PC the shares will disappear from your computer. To get the shares to survive a reboot, you need to add use the persistent switch. Note that you can also just use /P instead.
net use s: \\tower\movies /P:Yes
If you ever need to delete a mapped network drive, you can use the delete switch after specifying it’s drive letter.
net use s: /Delete
Hope this helps. If you have any other tips or tricks feel free to add more in the comments below!