net use Z: "\\Server01\Project Files\Q1 Reports" You can explicitly specify the domain and even the domain controller:
net use Z: /delete Always confirm by running net use again to ensure it is gone. To wipe all current network connections in one command (useful for login scripts to start fresh): cmd command to map network drive
In the modern IT environment, network drives remain the backbone of data sharing and centralized storage management. While the graphical user interface (GUI) of Windows—using "Map network drive" in File Explorer—is convenient for the average user, the command line offers unparalleled speed, automation, and troubleshooting capabilities. Whether you are a system administrator managing hundreds of workstations or a power user looking to optimize your workflow, mastering the net use command in Command Prompt (CMD) is an essential skill. net use Z: "\\Server01\Project Files\Q1 Reports" You can
$cred = Get-Credential New-PSDrive -Name "Z" -PSProvider FileSystem -Root "\\Server01\Projects" -Credential $cred -Persist Mapping network drives via the command line using net use is a powerful, flexible, and reliable method that every Windows professional should master. From quick one-off mappings to complex automated login scripts, the command line gives you control that the GUI simply cannot match. Whether you are a system administrator managing hundreds
:: Map department drives net use H: \Fileserver01\HomeFolders%username% net use S: \Fileserver01\Shared\Sales net use P: \PrintServer01\Scans
net use /persistent:yes If your server or share name contains spaces, enclose the entire UNC path in double quotes :