Drive From Command Line: Map
This feature dives deep into the art and science of mapping drives from the command line, from basic syntax to advanced scripting techniques. The net use command is a relic of the MS-DOS and OS/2 era, yet it remains one of the most reliable networking tools in modern Windows. It connects, disconnects, and displays information about shared resources. Basic Mapping Syntax The simplest form is almost poetic in its brevity:
net use Z: \\server\share This maps the share \\server\share to drive letter Z: . If the share requires authentication, net use will prompt you for a username and password. But you can supply them inline for automation: map drive from command line
net use Z: \\server\share /user:OtherDomain\jsmith /savecred You will be prompted for the password once. After that, any script or command using that same mapping will reuse the stored credential—useful for scheduled tasks, but a security consideration. Network paths with spaces require quotation marks. Drive letters do not: This feature dives deep into the art and
But for IT professionals, power users, and automation enthusiasts, the graphical approach is a bottleneck. It’s slow, inconsistent across remote sessions, and impossible to script. The command line—specifically net use and, more recently, PowerShell’s New-PSDrive —offers speed, precision, and repeatability. Basic Mapping Syntax The simplest form is almost
For decades, the average Windows user has mapped network drives the same way: open File Explorer, right-click "This PC," select "Map network drive," pick a letter, type a path, and click "Finish." It’s visual, intuitive, and serviceable for the occasional connection.