You most probably know how to assign a drive letter to a network share, but that’s not impressive. Why not change that by mapping your network shares from the command prompt?
Mapping a Network Drive in Windows
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
Alternatively, if you ever want to get rid of all the shares on your machine, you can use the wildcard character instead of specifying a specific drive letter.
net use * /Delete
That’s all there is to it.