Cmd Map Network Drive Better May 2026

Open Command Prompt as Administrator (for persistent / system-wide maps) or as your user.

The classic command is net use. A basic mapping looks like this:

net use Z: \\server\share

But "better" begins with its less-known flags: cmd map network drive better

A robust, production-ready mapping command:

net use Z: \\fileserver\data /persistent:yes /user:CONTOSO\jsmith *

The * forces a password prompt, avoiding hardcoded secrets in batch files. Open Command Prompt as Administrator (for persistent /

"Better" does not mean embedding plaintext passwords. Never do this:

net use Z: \\server\share /user:admin P@ssw0rd   # INSECURE

Instead:

While net use is adequate, PowerShell’s New-PSDrive (with -Persist) is superior for modern Windows. Consider:

New-PSDrive -Name Z -PSProvider FileSystem -Root \\server\share -Persist -Credential (Get-Credential)

The advantages over net use:

For pure drive mapping persistence across reboots, however, net use remains slightly more reliable in older environments. PowerShell’s -Persist only works for network drives, not local drives, and historically had issues with some domain trust configurations.

Mapping a network drive lets you assign a drive letter (like Z:) to a shared folder on another computer or NAS so you can access it like a local drive. In this post you'll learn how to map, disconnect, and troubleshoot network drives using the classic Windows Command Prompt (cmd.exe). I'll cover common options, practical examples, and tips for scripting and automation. But "better" begins with its less-known flags: