net use \\Server01\Projects The share will appear under "Network locations" in File Explorer, but not as a drive letter. If your current Windows login doesn't have access to the share, specify another account. You will be prompted for the password:
net use Z: \\Server01\Projects /persistent:no To change the default behavior for all subsequent commands until you change it again:
net use /persistent:yes If your server or share name contains spaces, enclose the entire UNC path in double quotes :
$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.
echo All drives mapped successfully. pause
net use The output will list drive letters, UNC paths, and status (OK, Disconnected, etc.).
net use Z: \\Server01\Projects /user:DOMAIN\john.doe P@ssw0rd123 Persistent vs. Temporary Mappings By default, mapped drives are persistent —they reconnect automatically after you log off and back on. To create a temporary mapping that disappears when you log off, use:
Cmd Command To Map Network Drive May 2026
net use \\Server01\Projects The share will appear under "Network locations" in File Explorer, but not as a drive letter. If your current Windows login doesn't have access to the share, specify another account. You will be prompted for the password:
net use Z: \\Server01\Projects /persistent:no To change the default behavior for all subsequent commands until you change it again: cmd command to map network drive
net use /persistent:yes If your server or share name contains spaces, enclose the entire UNC path in double quotes : net use \\Server01\Projects The share will appear under
$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. From quick one-off mappings to complex automated login
echo All drives mapped successfully. pause
net use The output will list drive letters, UNC paths, and status (OK, Disconnected, etc.).
net use Z: \\Server01\Projects /user:DOMAIN\john.doe P@ssw0rd123 Persistent vs. Temporary Mappings By default, mapped drives are persistent —they reconnect automatically after you log off and back on. To create a temporary mapping that disappears when you log off, use: