How to Map a Network Drive Using Command Prompt

2 min. readlast update: 07.16.2026

If Windows is unable to map a network drive through This PC > Map Network Drive, you can use Command Prompt as an alternative.

Before You Begin

You will need the following information:

  • The drive letter you want to assign, such as K:
  • The server name
  • The shared folder name
  • A valid Windows username and password

Map the Network Drive

  1. Open the Windows Start menu.
  2. Type Command Prompt.
  3. Right-click Command Prompt and select Run as administrator.
  4. Enter the following command:
net use K: \\SERVERNAME\kc7 /user:USERNAME PASSWORD
  1. Press Enter.

Replace the following information with the correct details:

  • K: with the drive letter you want to use
  • SERVERNAME with the name of the server
  • USERNAME with the Windows username
  • PASSWORD with the Windows password

Example

net use K: \\KC-SERVER\kc7 /user:Administrator ExamplePassword123

When the drive is mapped successfully, Command Prompt should display:

The command completed successfully.

The mapped drive should now appear under This PC in File Explorer.

Keep the Drive Mapped After Restarting

To have Windows reconnect the drive after the computer restarts, add /persistent:yes to the command:

net use K: \\SERVERNAME\kc7 /user:USERNAME PASSWORD /persistent:yes

If the Drive Letter Is Already in Use

If Windows reports that the drive letter is already being used, remove the existing connection with this command:

net use K: /delete

Then run the mapping command again.

Remove the Mapped Drive

To disconnect the mapped drive later, run:

net use K: /delete

Troubleshooting

If the command does not work, confirm the following:

  • The server computer is powered on.
  • The workstation and server are connected to the same network.
  • The server name is spelled correctly.
  • The kc7 folder is shared and accessible.
  • The username and password are correct.
  • The selected drive letter is not already assigned to another drive.

You can also test whether the workstation can communicate with the server by running:

ping SERVERNAME

If the server cannot be reached by name, try using the server's IP address:

net use K: \\192.168.1.100\kc7 /user:USERNAME PASSWORD

Security Note

Entering the password directly in the command may leave it visible on the screen or in the command history. To have Windows prompt for the password instead, use an asterisk:

net use K: \\SERVERNAME\kc7 /user:USERNAME *

Press Enter, then type the password when prompted. The password will not appear while you type it.

Was this article helpful?