network share w10 Pro to W10 pro works on gui but not from cmd line

  1.    #1

    network share w10 Pro to W10 pro works on gui but not from cmd line


    PC 1 is Windows 10 Pro 1809. On it we have set up a user called Corey. This is the PC with the shares
    PC 2 is Windows 10 Pro 1809. This is the client PC, it's user name is Corey.

    On PC 2 we have set up a Windows credential with user name Corey, a password and the network address of PC1

    We shared a folder on PC1 called Movies 1 (With the space). For diagnostic purposes Everyone has full control of the share and security on the share.

    On PC 2 I entered from a cmd prompt net use x: \\pc1"Movies 1" /persistent:yes

    This fails with Error 53 The network path is not found.

    If he maps a network drive via explorer it works fine.

    Why does the command not work?
      My ComputerSystem Spec

  2.    #2

    Simple you can have spaces in the cmd line for network shares
      My ComputerSystem Spec

  3. Bree's Avatar
    Posts : 11,932
    10 Home x64 (1903) (10 Pro on 2nd pc)
       #3

    Wobitancrawfodi said: View Post
    On PC 2 I entered from a cmd prompt net use x: \\pc1"Movies 1" /persistent:yes
    This fails with Error 53 The network path is not found.

    Why does the command not work?

    The correct syntax is \\servername\sharename. You missed out the \ before the share name. You need the quotes because of the space in the name, but they should be around the whole string. Try:

    net use x: "\\pc1\Movies 1" /persistent:yes
      My ComputersSystem Spec

  4.    #4

    @Bree Sorry that was a typo. I didn't miss the backslash in the command. I even edited the post to add the backslash after I noticed the typo but it doesn't seem to have stuck.

    I understand the syntax and why spaces are needed. Sorry, the typo has made me look like a real noob.

    OK, perhaps I need to be specific. Here are the exact commands in the start up file...

    @Echo off
    net use p: \\corey-kodi-pc\Documentaries /persistent:yes >NUL
    net use q: \\corey-kodi-pc"TV Shows" /persistent:yes >NUL
    net use r: \\corey-kodi-pc"TV Shows 2" /persistent:yes >NUL
    net use s: \\corey-kodi-pc"Movies 1" /persistent:yes >NUL
    net use t: \\corey-kodi-pc"Movies 2" /persistent:yes >NUL

    The client PC is called Corey-PC.
    On corey-kodi-pc a user exists called corey with a password.
    On corey-pc I have set up a windows credential to \\corey-kodi-pc, username corey and the correct password.

    We know that's correct because when he maps the drive via explorer gui he is not asked for credentials.

    Network discovery is enabled on both PCs. As is file and printer sharing. Both PCs show the network connections as Private. Both PCs are on the same network - 192.168.1.0/16.

    The above script is executed at login. I have the exact same set up on 10 PCs here at my place. It works perfectly. The ONLY difference is that my equivalent of his corey-kodi-pc is a Windows 2012 R2 server.

    The reason it is set up this way is that Windows does not connect the drives at login. They are mapped, but have that dreaded red X which crashes many applications. The script results in the drives being properly mapped and connected.

    The whole point of the set up is that it is automated. corey-kodi-pc automatically powers up at 2pm. corey-pc powers up at 2:05pm. As this is an unattended set up, the drives need to be mapped and connected otherwise file transfers and macrium backups fail.
      My ComputerSystem Spec

  5. Bree's Avatar
    Posts : 11,932
    10 Home x64 (1903) (10 Pro on 2nd pc)
       #5

    I repeat, you have to put the quotes around the whole of the text string you want to use as a parameter for 'net use'.

    \\corey-kodi-pc"TV Shows 2"

    should be:

    "\\corey-kodi-pc\TV Shows 2"
      My ComputersSystem Spec

  6.   My ComputerSystem Spec


  7.    #7

    Fixed it. Initially my son had mapped the drives with different drive letters than the ones shown above.
    He was also missing the following registry key, which I added and set to 0.
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\RestoreConnection
    I then added a few seconds delay in the start up task, as his NIC was taking a few seconds to be detected (Yellow Triangle for 4 seconds).
    So when the script was running it was complaining about the drive letter being used for a different share. Deleted all the share entries from the registry (HKCU\Network), and rebooted.

    Works perfectly now, and the drives mapping correctly and are showing as connected.

    - - - Updated - - -

    I think this forum software is messing with my posts. The \ before the share name is definitely present in the script, but doesn't dhow on the posts here.

    When I write backslash" it deletes the \. Must be seeing it as an escape character or something
      My ComputerSystem Spec

  8. Bree's Avatar
    Posts : 11,932
    10 Home x64 (1903) (10 Pro on 2nd pc)
       #8

    Wobitancrawfodi said: View Post
    I think this forum software is messing with my posts. The \ before the share name is definitely present in the script, but doesn't dhow on the posts here.

    When I write backslash" it deletes the \. Must be seeing it as an escape character or something



    Yes, I've tested that and it does seem to strip the \ from the \" combination.

    You can (as I did above) wrap [noparse][/noparse] tags around it. Alternatively use the # button in the editor to put it in a Code box.

    Code:
    like this \"

    HOWEVER, my comment still stands that you cannot put the quotes just around the share name, it should be around the whole \\server\sharename string.

    Click image for larger version. 

Name:	image.png 
Views:	9 
Size:	7.2 KB 
ID:	243225
      My ComputersSystem Spec


 

Related Threads
I've been having issues with my laptop, a dell latitude 8850 not being able to connect to any network shares. Don't think it ever worked since I've had it. The machine in question is a windows 10 pro and is fully up to date Tried with shares...
When I try to share a website using the Mail App in Microsoft Edge, the first time I try the Mail App window opens, stays blank, and does nothing else. The second time I try to share the email completes and I'm able to send. I then try to share...
I know you can see what applications are using how much data in a given period of time by going to Start -> Settings -> Network & Internet -> Data Usage, then clicking the Usage Details option to bring up a list. Does anyone know if there's a...
I am attempting to add a printer via the command line using a batch file as an admin (to eventually deploy via SCCM TS on Win10): rundll32 printui.dll,PrintUIEntry /in /ga /n"\\my network printer" The command appears to run successfully but I am...
Searched thru post, lots of near misses but no solution to my issue. Only on windows 10 does this problem exist. I connect office equipment to customers pcs/networks. I use a script to create a hidden/special user that has admin permissions...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 00:37.
Find Us