How to Map a Network Drive Using Command Prompt (Windows)
If you need to map a network drive to a remote storage box using the command line, you can use the net use
command. Below is an example of how you can do this:
Sample Details:
- Storage Box Hostname:
storagebox.example.com
- Share Name:
backup
- Drive Letter:
Z:
- Username:
user123
- Password:
p@ssw0rd123
Command:
net use Z: \\storagebox.example.com\backup /user:user123 p@ssw0rd123 /persistent:yes
Explanation:
Z:
: The drive letter that will be assigned to the network share.\\storagebox.example.com\backup
: The UNC path to the shared folder on the remote storage box./user:user123
: The username required to authenticate with the storage box.p@ssw0rd123
: The password associated with the username./persistent:yes
: Ensures the drive is reconnected automatically at each login.
This command is useful when you need to access files on a remote server as if they were on a local drive. The /persistent:yes
option makes sure the drive mapping persists across reboots.