Tip: Unmap (disconnect) network drive via command line (cmd)
When you have to disconnect a network drive, you first need to know which drives are connected. You may encounter a problem (especially for Windows 10 users), that is, your network drive does not appear under your computer window, but when you try to connect, you will receive a message stating that they are connected and may even be used Is a different username 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
in the cmd command line
3. Display the list of current network drives attached
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.
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
. To stop / disconnect a network drive correctly, use this command
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
in the command line. If the entry is gone, you have been successful.
More discussion on this topic: