How to Map a Network Drive to Windows Machine - net use Command Example

Mapping network drive in Windows 10 or other versions of Windows operating system e.g. Windows 7  or Windows 8 is much easier and faster by using the command line than by doing it on Windows Explorer. If you have been working in Windows environment with a bunch of Windows Server 2016 or 2012  servers and your job requires frequent access, copy or paste from the local machine to those remote machines than mapping them as a network drive is the best option. You can use mapped network drive as any other folder which makes the job of copy paste very simple. Though windows provide multiple ways to map a network drive, I prefer to use command line i.e. "net use" command to map my windows network drives.

This works in Windows 10 and should work in other versions of Windows operating system as well e.g. Windows 7 or Windows Server 2016 without any fuss.

Its way faster than accessing every single node on a network to reach desired fast and In order to use this, you just need to change of network drive.

In our last post on Windows operating system, we have seen How to find IP address from a hostname and this article we will see how to map remote host as a network drive in Windows 10. Anyway enough talking,

let's see the command to map a network drive in windows:

NET USE command to map a network drive in Windows

Windows command to map network drive is "net use" and we will use option * which automatically assigns a name of drive e.g. X drive, Y drive, Z drive.

Now let's see an example of mapping D:\ drive of remote host as windows mapped a drive in your desktop:

C:\Documents and Settings\supportUser>net use * \\\D$ * /u:domain\username

Type the password for \\\D$:

Drive S: is now connected to \\\D$.

The command completed successfully.

Now this network folder will be visible as S:\ drive in your My Computer.

1. Command to show windows mapped network drive

Here is a command to show all network drive which is mapped, we will use same net use command without any option to see all drives as shown below:

C:\Documents and Settings\supportUser>net use

New connections will be remembered.

Status       Local     Remote                    Network


OK           A:        \\hostname1\drive1       Microsoft Windows Network

OK           I:        \\hostname1\drive1       Microsoft Windows Network

Disconnected N:        \\hostname3\drive3       Microsoft Windows Network

Unavailable  Z:        \\hostname3\d$           Microsoft Windows Network

The command completed successfully.

2. Command to disconnect mapped network drive in Windows 10

You can use same command net use to even disconnect mapped network drive, just pass /d argument to net use command for disconnecting mapped network drive as shown below :

C:\Documents and Settings\supportuser>net use /d z:

z: was deleted successfully.

So far, we have seen how to use the "net use" command to configure and disconnect a network drive on Windows laptop. Btw, if you want to do it Windows way e.g. by using GUI interface then you can also do so starting from Windows 7 as shown below:

How to Map a Network Drive to Windows Machine - net use Command Example

That’s all on windows command to map remote host as a network drive in Windows 10 and Windows Server 2016. As I said using the command line to map network drive is much faster than using windows explorer, it prevents your computer from being hung during the mapping process.  Btw, if you are interested in more scripting work on Windows like Linux, I encourage you to learn Powershell, which gives you the power of Linux in Windows.

Sincenet use is one of basic command this trick should also work on other versions of Windows operating system e.g. Windows 11 or Windows Server 2019.

Let us know if you find any other faster way of mapping drives in Windows 10 or other Windows version.

Other Technical Resources you may like

Learning Task Automation using Windows PowerShell

How to use xargs command with find and grep in Linux

5 Free Course to Learn Linux Online

10 Free Courses to Learn Docker Online

10 Examples of lsof command in Linux

Linux command to find the size of a directory with example

How to change file permissions in UNIX using the chmod command

Mastering DNS on Windows Server 2016

Thanks for reading this article so far. If you like this tip then please share with your friends and colleagues. If you have any questions or feedback then please drop a note.

No comments for "How to Map a Network Drive to Windows Machine - net use Command Example"