Tip: Unmap (disconnect) network drive via command line (cmd)

When you have to disconnect your network drives you first need to know which ones of them are connected. You can run into issues (especially Windows 10 users) that your network drives do not appear under your Computer window, but when you try to connect, you will get a message that they are already connected, maybe even with a different username that you tried.

This leads you into needing to unmap the drives via command line.

How to list and unmap network drives via command line?

1. Start command prompt as administrator.

Type cmd in your search box and right click the icon, then select “Run as administrator”



2. Move to C disk or other location rather than staying in Windows\System32 in command line.

To navigate to C:\ disk Type cd c:\ in the cmd command line


3. Display the list of current network drives attached

Type net use and hit enter – this will display the network drives.

It is better for deleting if you output the results in a text file where you can copy the paths later.

Type net use > networkdrives.txt in the command line, then a file named networkdrives.txt will be saved to C disk (go and open it).


4. Unmap the drives you want to unmap.

Disconnecting a drive via command line is performed by net use. To stop / disconnect a network drive correctly, use this command

net use \\thepath\toyournetworkfolder /delete

See Microsoft Technet for all options of net use.

Tip: the path to your network folder, that you have attached as a network drive can be copied and pasted via mouse right click to command line from the txt file we generated in step 3.

Now you have disconnected the network drive.

Make sure to check again by typing net use in the command line. If the entry is gone, you have been successful.


More discussion on the subject:





Post Author: Tom Pai