Windows – Net use \\localhost\c$ – command fail with error 1231

command linewindowswindows 7

on my windows 7 x64 , i'm trying to execute this command :

net use \\localhost\c$

But the command fail with the error 1231, Network location cannot be reached.
I've tried to re create again the admin share c$ (c:) , but it's the same situation.
On another Windows 7 machine , this command is completed successfully.
What can i do ?
Thank you !

Best Answer

The command fail with the error 1231, Network location cannot be reached

net use \localhost\c$

The above command is invalid as the syntax is incorrect.

  1. You are missing a device name.

  2. computername (in this case localhost) should start with two backslashes \\ (this is the actual cause of the error).

On another Windows 7 machine , this command is completed successfully.

That is not possible as it is an invalid command.

Try the following command (replace the drive letter as appropriate):

net use j: \\localhost\c$

You could also use:

net use \\localhost\c$

but this seems a pointless command as this is creating a remote reference (to a local resource) that has no local reference (device name) that can actually refer to it.

Example:

F:\test>net use j: \\localhost\c$
The command completed successfully.


F:\test>net use
New connections will be remembered.


Status       Local     Remote                    Network

-------------------------------------------------------------------------------
OK           J:        \\localhost\c$            Microsoft Windows Network
The command completed successfully.

F:\test>net use \\localhost\c$
The command completed successfully.


F:\test>net use
New connections will be remembered.


Status       Local     Remote                    Network

-------------------------------------------------------------------------------
OK                     \\localhost\c$            Microsoft Windows Network
The command completed successfully.

Syntax

F:\test>net use /?
The syntax of this command is:

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}]]

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

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

Further Reading

Related Question