How to map network drive from Command Prompt on Windows 10

You can use Command Prompt to map a network drive on Windows 10, and here's how to do it.

Command Prompt mapping network drive command
Command Prompt mapping network drive command
  • To map a network drive on Windows 10, open “Command Prompt” (not as admin) and run the “net use Z: \\server\shareFolder” command.
  • The “net use z: /Delete” command will disconnect the map from Windows 10.

UPDATED 12/7/2023: On Windows 10, it’s possible to map a network drive in several ways, including from Command Prompt when you prefer to use command lines or create a script to access files stored on another computer.

When connecting to a network drive, Windows 10 creates a “shortcut” pointing to the shared folder with a drive letter and the username and password to access its content. Once a drive is mapped, it will appear on “This PC” under “Network locations” to quickly access files stored on another computer from File Explorer.

In this guide, I will teach you 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.

Map network drive on Windows 10 from Command Prompt

To use the net command to map a shared folder as a drive, use these steps:

  1. Open Start on Windows 10.

  2. 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 won’t appear in File Explorer. As a result, run the command as a standard user.
  3. 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 computer name or IP address of the device hosting the shared folder and the shared name. For example, this command maps the ShareOne folder to the computer with the “Z” drive letter:

    net use Z: \\vm-beta\ShareOne

    Map folder with manual drive letter

  4. 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” with the device’s computer name or IP address hosting the shared folder and the shared name. For example, this command maps the ShareOne folder to the computer:

    net use * \\vm-beta\ShareOne

    Map folder with automatic drive letter

  5. 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 computer name or IP address of the device hosting the shared folder and the shared name. The “PASSWORD” and “USERNAME” must be replaced with the credentials to authenticate with the remote machine. The “persistent” option allows the folder to stay mapped after reboot. For example, this command maps the ShareOne folder, providing the user credentials and making the mapping persistent:

    net use Z: \\vm-beta\ShareOne password /user:admin /persistent:yes

    Map folder with credentials

Once you complete the steps, the network folder will map on the device and appear in File Explorer.

Disconnect mapped network drive on Windows 10 from Command Prompt

To disconnect a network drive on Windows 10, use these steps:

  1. Open Start.

  2. Search for Command Prompt and click the top result to open the console.

  3. Type the following command to disconnect a mapped network drive and press Enter:

    net use z: /Delete
    

    Command Prompt disconnect mapped drive

    In the command, replace “Z” with the drive letter to remove.

  4. 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 I’m writing this guide on focus for Windows 10, you can use these steps on Windows 8.1, 7, and earlier versions. Use these instructions if you want to use File Explorer.

Update December 7, 2023: This guide has been updated to ensure accuracy and reflect changes.

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 15 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 21 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me. Email him at [email protected].