Cmd Command To Map Network Drive Guide

net use /verbose To remove a specific mapped drive:

$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.

New-PSDrive -Name "Z" -PSProvider FileSystem -Root "\\Server01\Projects" -Persist The -Persist switch is equivalent to /persistent:yes in CMD. PowerShell also allows mapping using different credentials: cmd command to map network drive

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:

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): net use /verbose To remove a specific mapped

net use /persistent:yes If your server or share name contains spaces, enclose the entire UNC path in double quotes :

net use Z: \\Server01\Projects /user:DOMAIN\john.doe * Alternatively, provide the password in the command (less secure, see security section below): To wipe all current network connections in one

net use Z: \\Server01\Projects If the command succeeds, you will see: The command completed successfully. You can now open Z: in File Explorer. Sometimes you only need to access a share without cluttering your drive list. You can create a connection without a letter: