Map Drive Command Line Jun 2026

You can save these commands into a .bat or .ps1 file and place it in the Windows "Startup" folder to ensure your team always has the right folders available.

The asterisk automatically picks the first available drive letter.

Whether you're automating a deployment or just tired of the GUI, here is everything you need to know about the net use command and its modern PowerShell counterpart. 1. The Classic Method: Using net use map drive command line

NET USE Z: /DELETE

@echo off NET USE Z: /DELETE /Y >nul 2>&1 NET USE Z: \\fileserver01\Shared /PERSISTENT:NO NET USE Y: \\fileserver02\Departments\HR /USER:MYDOMAIN\%USERNAME% * You can save these commands into a

Note: The -Persist parameter makes it visible in File Explorer. Without it, the drive only exists inside the PowerShell session.

4 Answers. Sorted by: 11. You can test for the existence of a drive or folder by testing if the special file "nul" exists in it, i... Server Fault How to find the UNC path for a network storage location - Help Site At the Windows search prompt, type command, then press enter. This will open a command prompt window. At the command prompt, type ... University of Guelph Guide: How to Map a Network Drive in Windows - NinjaOne Mar 20, 2026 — 4 Answers

Output example: "Drive Y: is now connected to..."

To ensure the drive is mapped every time you log on, use the /persistent:yes option:

The net use command has been the standard for Windows networking since the DOS days. It is reliable and works in both Command Prompt (CMD) and PowerShell. The Basic Syntax To map a drive letter to a network path, use this format: net use [DriveLetter]: \\[ServerName]\[ShareName] Use code with caution. net use Z: \\TechServer\Marketing Use code with caution. Mapping with Credentials