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


  1. Posts : 425
    Windows 10
       #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 Computer


  2. Posts : 8,049
    windows 10
       #2

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


  3. Posts : 31,398
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #3

    Wobitancrawfodi said:
    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 Computers


  4. Posts : 425
    Windows 10
    Thread Starter
       #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 Computer


  5. Posts : 31,398
    10 Home x64 (22H2) (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 Computers

  6.   My Computer


  7. Posts : 425
    Windows 10
    Thread Starter
       #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 Computer


  8. Posts : 31,398
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #8

    Wobitancrawfodi said:
    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.

    network share w10 Pro to W10 pro works on gui but not from cmd line-image.png
      My Computers


 

  Related Discussions
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:41.
Find Us




Windows 10 Forums