We can connect to shared folders on the network using Net use command. Whatever ‘Map Network drive’ does in explorer, ‘Net use’ command does the same thing from command line.
Below you can find the syntax of this command with some examples.
Map a network share to a drive
Let’s say you have a network share \\RemotePC\Share which you want to map to a drive. You can do that with the below command.
Net use * \\RemotePC\Share
The above command would try to map the share to the first available drive starting from Z: We can also specify the drive name in the place of ‘*’. If you try to map to a network drive that’s not available you would get the below error.
c:\>net use Z: \\remptepc\share
System error 85 has occurred.
The local device name is already in use.
See Map network drive from command line for advanced options for net use and for specifying user name and passwords in the command line.
Delete/Disconnect a mapped drive
You can disconnect a mapped drive using ‘net use /delete’ command. For example, to disconnect the drive Z: the command is
net use Z: /delete
Delete all mapped network drives
You can delete all mapped drives using the below command.
net use * /delete
Get current mapped drives list
c:\>net use
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
Z: \\remotepc\share
Microsoft Windows Network
The command completed successfully.
{ 0 comments… add one now }