How to Use Net Use Command in Windows 11
In this article
Yes, you can use the net use command in Windows 11 to connect to shared network resources like folders, printers, or drives hosted on another computer or server. This built-in command-line tool lets you map network drives, disconnect from them, and view current connections—all from Command Prompt or PowerShell. Before starting, ensure your network is configured correctly and you have access permissions to the shared resource.
What You'll Need
- A working network connection (wired or Wi-Fi)
- Access to a shared folder, drive, or printer on another device
- Permission credentials (username and password) if the resource is secured
- Knowledge of the network path (e.g., \\ComputerName\Share or \\IPAddress\Share)
- Administrative privileges (optional, but helpful for troubleshooting)
Step-by-Step
- Press the Windows key, type "Command Prompt" or "cmd", then select Run as administrator. Alternatively, open PowerShell with admin rights for the same functionality.
- In the Command Prompt window, type
net useand press Enter to view any currently mapped network drives. This shows active connections and helps avoid duplicate mappings. - To map a network drive, type the full command:
net use X: \\ComputerName\ShareName, replacing X: with your preferred drive letter and \\ComputerName\ShareName with the actual network path. For example:net use Z: \\192.168.1.100\Documents. - If the shared resource requires a username and password, add them to the command:
net use X: \\ComputerName\ShareName /user:Username Password. Replace "Username" and "Password" with valid credentials. If you omit the password, Windows will prompt you to enter it securely. - To make the connection persistent (reconnect automatically at login), add the
/persistent:yesflag:net use X: \\ComputerName\ShareName /persistent:yes. To prevent auto-reconnect, use/persistent:no. - Press Enter. If successful, you'll see "The command completed successfully." You can now access the drive via File Explorer under This PC.
- To disconnect a mapped drive, type
net use X: /delete, replacing X: with the correct drive letter. Confirm if prompted. To disconnect all mapped drives, usenet use * /delete. - For printer sharing, use
net use LPT1: \\ComputerName\PrinterShareto connect a network printer to a local port (LPT1). Note: This is less common today due to modern print spoolers. - After mapping, verify access by opening File Explorer and navigating to the assigned drive letter. If files are visible, the connection works.
- Close Command Prompt when finished. Persistent connections will reappear after restart.
Common Mistakes
- Using forward slashes (/) instead of double backslashes (\\) in the network path. Windows requires double backslashes for UNC paths.
- Typing an incorrect drive letter or overwriting an existing one. Always check current mappings with
net usefirst. - Forgetting to include credentials on secured shares, leading to "Access Denied" errors.
- Using a computer name that isn’t resolvable on the network. If DNS or NetBIOS fails, use the IP address instead.
- Mapping to a share that doesn’t exist or has been disabled on the host machine.
- Ignoring firewall settings—Windows Defender or third-party firewalls may block file and printer sharing.
Tips
- Use IP addresses instead of computer names if name resolution is unreliable on your network.
- Save frequently used
net usecommands in a batch (.bat) file for quick access. - Map administrative shares like C$ only if you have admin rights on the remote machine.
- Use
net use * /deletecautiously—it removes all connections, which may disrupt open files or apps. - Combine with Group Policy or login scripts in business environments to automate drive mapping.
- Test connectivity first using
ping ComputerNameorping IPAddressbefore runningnet use.
Troubleshooting
If the net use command fails, start with basic checks. First, ensure both devices are on the same network and can ping each other. Run ping \\ComputerName or use ping IPAddress to verify reachability. If unreachable, check router settings, Wi-Fi connection, or cable integrity.
Next, confirm that file and printer sharing is enabled. Open Control Panel > Network and Sharing Center > Change advanced sharing settings, then ensure "Turn on file and printer sharing" is selected for your network profile.
If you receive "System error 5 has occurred," this means access is denied. Re-run the command with the correct username and password, especially if connecting to a workgroup machine or remote server. Use the /user: parameter explicitly.
For "The network path was not found" error, double-check the UNC path. Ensure the shared folder exists and is shared properly. On the host PC, right-click the folder, go to Properties > Sharing tab, and confirm the share name.
Firewall issues are common. Temporarily disable third-party antivirus firewalls or adjust Windows Defender Firewall settings to allow File and Printer Sharing (SMB-In) rules.
If the drive appears but shows no files, verify share permissions and NTFS permissions on the host. Both must allow read (or write) access for the connecting user.
Reboot both machines if changes don’t take effect. Sometimes, network discovery services need a restart to propagate settings.
Frequently Asked Questions
Can I use net use without admin rights?
Yes, you can use net use as a standard user to map network drives, as long as you have access to the shared resource and the drive letter isn’t restricted by policy.
Does net use work over the internet?
Not directly. Net use is designed for local networks. To access remote shares over the internet, use a VPN to join the remote network first.
Why does my mapped drive disappear after reboot?
This happens if you didn’t use /persistent:yes. Reconnect with the persistent flag, or map the drive through File Explorer for automatic persistence.
Can I map a network drive using Wi-Fi?
Yes, net use works over Wi-Fi as long as both devices are on the same network and sharing is enabled.
What’s the difference between net use and mapping in File Explorer?
Both achieve the same result. Net use is scriptable and faster for advanced users; File Explorer offers a GUI but less control over options like persistence and credentials.
Can net use connect to a Linux Samba share?
Yes, if the Samba server is configured to allow Windows-compatible sharing and the correct credentials are provided, net use can map Samba shares using their IP and share name.