Trouble using command prompt to mount a network drive

When I tried to mount the drive with the following command:

net use x:\\folder\Sharename

I get the following error:

"System error 67 has occurred the network name cannot be found"

When I try to do the following it works - but of course mounts the drive with a random assigned name:

pushd \\folder\Sharename

I know I am missing something here. When I navigate to \\folder\Sharename in explorer it works, I have permissions to access it and the network path is reachable.

I have deduced it's either a syntax error, or I'm simply trying to use the command wrongly.


Using the command line mount a network drive

net use x:\\folder\Sharename

The syntax of the above command is incorrect.

It should be:

net use x: \\folder\Sharename 

Note the additional space.


Syntax

NET USE [devicename | *] [\\computername\sharename[\volume] [password | *]]
        [/USER:[domainname\]username]
        [/USER:[dotted domain name\]username]
        [/USER:[username@dotted domain name]
        [/SMARTCARD] [/SAVECRED] [[/DELETE] | [/PERSISTENT:{YES | NO}]]

Map to the current user's home directory as specified in the users Active Directory record:

NET USE {devicename | *} [password | *] /HOME

Set defaults:

NET USE [/PERSISTENT:{YES | NO}]

...

Examples:

 NET USE [driveletter:] \\ComputerName\ShareName /PERSISTENT:YES
 NET USE [driveletter:] \\ComputerName\ShareName\folder1\folder2 /PERSISTENT:No
 NET USE H: /Home
 NET USE J: \\MainServer\Users\%Username%
 NET USE W: \\MainServer\GroupShare /Persistent:No
 NET USE \\MainServer\SharedPrinter

Source net use


Further Reading

  • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
  • net use - Map a drive letter to a remote server/share.

net use x: \\computer name\share name

You need to separate the drive letter from the network share with a space.