Monday, December 17, 2012

Mapping network drive in Windows XP and 7 – net use command Example

Mapping network drive in Windows XP or Windows 7 is much easier and faster by using command line than by doing it on Windows explorer. If you have been working in Windows environment with bunch of Windows 2000 or 2003 servers and your job requires frequent access, copy or paste from local machine to those remote machine than mapping them as network drive is the best option. You can use mapped network drive as any other folder which makes job of copy paste very simple. Though windows provides multiple ways to map network drive, I prefer to use command line i.e. "net use" command to map my windows network drives. This works in Windows XP and should work in Windows 7 without any fuss, its way faster than accessing every singlet node on 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 hostname and this article we will see how to map remote host as network drive in windows XP. Any way enough talking, let's see command to map network drive in windows:

Net use command to map network drive in Windows XP and 7

windows command to map network drive - net use exampleWindows command to map network drive is "net use" and we will use option * which automatically  assign 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 drive in your desktop:

C:\Documents and Settings\supportUser>net use * \\remoteHost.com\D$ * /u:domain\username
Type the password for \\remoteHost.com\D$:
Drive S: is now connected to \\remoteHost.com\D$.
The command completed successfully.

Now this network folder will be visible as S:\ drive in your My computer as shown below:

Command to show windows mapped network drive
Here is 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.


Command to disconnect mapped network drive in Windows XP and 7
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.

That’s all on windows command to map remote host as network drive in windows XP. As I said using command line to map network drive is much faster than using windows explorer, it prevents your computer from being hung during mapping process. Since net use is one of basic command this trick should also work on other version of Windows operating system e.g. windows 7 or Windows 8. Let me know if you find any other faster way of mapping drives in Windows XP or Windows 7.

Other technical articles from Javarevisited

1 comment :

Anonymous said...

It appears that passing credentials through "net use" does not influence Explorer in Windows 7 any more. Even after successful "net use" on ipc$ or particular x$ drive Explorer asks for credentials when entering the address for the same machine.

Do you have any idea how to find a solution to that problem?

Post a Comment