On Windows 10, you can quickly map a network drive in a number of ways, including using Command Prompt when you prefer to use command lines or creating a script to access files stored on another computer.
When connecting to a network drive, 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 will then appear on “This PC,” under “Network locations,” for quicker access to files stored on another computer from File Explorer.
In this guide, you will learn the steps to use Command Prompt to map a network drive on Windows 10, and how to disconnect when you no longer need access to the shared folder.
How to map network drive with Command Prompt
To use the net command to map a shared folder as a drive, use these steps:
-
Open Start on Windows 10.
-
Search for Command Prompt and click the top result to open the console.
Quick note: If you run the command as an administrator, the drive may not mount correctly, and it won’t appear in File Explorer. As a result, make sure to run the command as a standard user. -
Type the following command to map a drive assigning drive letter manually and press Enter:
net use Z: \\DEVICE-NAME-OR-IP\SHARED-FOLDER
In the command, replace “Z” with the drive letter not already in use you want to use. Then replace DEVICE-NAME-OR-IP and SHARED-FOLDER for the name of the computer name or IP address of the device hosting the shared folder and the name of the shared.
For example, this command maps the ShareOne folder to the computer with the “Z” drive letter:
net use Z: \\vm-beta\ShareOne
.Windows_Software_Technology-Big-343{display:inline-block;width:300px;height:600px}@media(min-width: 500px){.Windows_Software_Technology-Big-343{width:300px;height:600px}} -
Type the following command to map a drive assigning drive letter automatically and press Enter:
net use * \\DEVICE-NAME-OR-IP\SHARED-FOLDER
In the command, the (*) is the option that allows the system to assign any drive letter that is not already in use. Then replace DEVICE-NAME-OR-IP and SHARED-FOLDER for the name of the computer name or IP address of the device hosting the shared folder and the name of the shared.
For example, this command maps the ShareOne folder to the computer:
net use * \\vm-beta\ShareOne
-
Type the following command to map a drive providing authentication details and press Enter:
net use Z: \\DEVICE-NAME-OR-IP\SHARED-FOLDER PASSWORD /user:USERNAME /persistent:yes
In the command, replace “Z” with the drive letter not already in use you want to use. Then change DEVICE-NAME-OR-IP and SHARED-FOLDER for the name of the computer name or IP address of the device hosting the shared folder and the name of the shared. The PASSWORD and USERNAME have to be replaced with the credentials to authenticate with the remote device. The “persistent” option allows the folder to stay mapped after reboot.
For example, this command maps the ShareOne folder providing the user credentials and makes the mapping persistent:
net use Z: \\vm-beta\ShareOne password /user:admin /persistent:yes
Once you complete the steps, the network shared folder will map on the device, and it will appear in File Explorer.
How to disconnect mapped network drive with Command Prompt
To disconnect a network drive on Windows 10, use these steps:
-
Open Start.
-
Search for Command Prompt and click the top result to open the console.
-
Type the following command to disconnect a mapped network drive and press Enter:
net use z: /Delete
In the command, replace “Z” for the drive letter of the map you want to remove.
-
Type the following command to disconnect all the mapped network drives and press Enter:
net use * /Delete
After you complete the steps, the mapped drives will be disconnected and no longer accessible from File Explorer.
While we are focusing this guide on Windows 10, you can use these steps on Windows 8.1, Windows 7, and earlier versions. If you want to use File Explorer to complete this task, then use these instructions.
Post a Comment