COMMAND
net useMap and manage network drives
net use connects a Windows machine to a shared folder over SMB, optionally mapping it to a drive letter. net use Z: \\server\share maps a drive; net use alone lists current connections; and net use Z: /delete disconnects. It is the command-line equivalent of "Map network drive".
Purpose
net use manages connections to shared folders over SMB, the Windows file-sharing protocol. It maps a share to a drive letter, connects with specific credentials, lists what is connected, and disconnects.
Map a drive
net use Z: \\server\share
net use Z: \\server\share /user:DOMAIN\username *
net use Z: \\server\share /user:username password /persistent:yes*prompts for the password instead of putting it on the command line./persistent:yesreconnects the drive at each logon;nomakes it session-only.
List connections
net useStatus Local Remote Network
-------------------------------------------------------------
OK Z: \\server\share Microsoft Windows NetworkDisconnect
net use Z: /delete
net use * /deleteConnect without a drive letter
net use \\server\share /user:DOMAIN\username *This authenticates to the server so that UNC paths (\\server\share\...) work without mapping a letter, useful in scripts.
Common errors
| Message | Likely cause |
|---|---|
| System error 53 / 0x80070035: network path not found | Wrong name, server down, SMB blocked, discovery off (0x80070035) |
| System error 5: access denied | Wrong credentials or no share/NTFS permission (file permissions) |
| System error 1219: conflicting credentials | An existing connection to the same server uses a different account; disconnect it first |
| System error 67: network name cannot be found | The share name is wrong or the Server service is stopped on the target |
Cautions
- Credentials on the command line are visible in history and to other users; prefer
*to be prompted, or store them in Credential Manager. - Mapped drives are per user. A drive mapped in a normal session is not visible to an elevated one by default (a UAC behaviour); map in the context that needs it.
PowerShell equivalent
New-PSDrive -Name Z -PSProvider FileSystem -Root \\server\share -Persist -Credential (Get-Credential) maps a drive; Remove-PSDrive Z disconnects; Get-SmbMapping lists SMB mappings.
Frequently asked questions
How do I map a network drive from the command line?
net use Z: \\server\share /user:DOMAIN\username * maps \\server\share to Z: and prompts for the password. Add /persistent:yes to reconnect at logon.
How do I disconnect a mapped drive?
net use Z: /delete removes one mapping; net use * /delete removes all. If a drive is "in use", close open files and Explorer windows on it first.
System error 53 or 0x80070035 — the network path was not found. Why?
The share name is wrong, the server is unreachable, SMB (port 445) is blocked or disabled, or Network Discovery is off. See the 0x80070035 record for the full checklist.