On Windows 10, you can quickly map a network drive in a number of different ways, including using Command Prompt when you prefer to use command lines or you’re creating an script, to access files stored on another PC in the network.
When connecting to a network drive using mapping, Windows 10 is essentially creating a “shortcut” that points to the shared folder with a drive letter and the username and password to access its content. Once a drive is mapped, it’ll then appear on “This PC” under “Network locations” for quick access to files stored on another computer.
In this guide, you’ll learn the steps to use Command Prompt to map a network drive on Windows 10, and how to disconnect when you no longer to access the shared folder.
How to use Command Prompt to map a network drive
On Windows 10, you can use the
net use command to map a network drives to your computer, which then it’ll appear in File Explorer.
It’s essential that you know the UNC path of the shared folder before using these commands.
You’ll need to open Command Prompt and to do this, simply open Start, do a search for Command Prompt, right-click the result and select Run as administrator.
To map a network drive using Z as the drive letter that isn’t password protected, use the following command and press Enter:
net use z: \\networkShare\files
To map a network drive using Z as the drive letter that is password protected, use the following command and press Enter:
net use z: \\networkShare\files /user:userName PaZZw0rd
Remember to replace userName and PaZZw0wd with the username and password of your shared folder.
Using the commands mentioned above, every time you restart your computer, the maps will be automatically removed, because we didn’t specify to be persistent.
To map a network drive that will stay connected after rebooting, you must specify to be persistent, and to do that you can use the following command and press Enter:
net use z: \\networkShare\files /P:yes
The /P switch ensure that the connection to the network share will be persistent. You can append the /P when using authentication to map a network drive.
To remove, disconnect, or delete a mapped network drive that uses Z as the drive letter, you can use the following command and press Enter:
net use z: /Delete
If you have more than one network drive mapped on your computer, you can disconnect them all using the following command and press Enter:
net use * /Delete
Once you completed the task, you’ll no longer see any mapped network drive on File Explorer. If you prefer using a wizard to map a network drive, you can use this guide.
While we’re focusing this guide on Windows 10, you can use these steps on Windows 8.1, Windows 7, and earlier versions.