We help IT Professionals succeed at work.

Accessing uNC paths from CMD line/bat file

GST-GRIDTECH
GST-GRIDTECH asked
on
Hi.
I'm might be missing something here.
However, we use a batch file that easily does a
Xcopy "\\serverName\path1\path2\*" "C:\programs\pathlocal1\pathlocal2" /s /e /y

On widows 7
But doesn't work on
Windows 10.

Am I missing some basic understanding here.

I guess I could just map it but wanted to understand why it works in windows7 but doesn't work in windows10

Thank you
Comment
Watch Question

CESNetwork Administrator

Commented:
Not sure if it matters but, are you using capital letters for the switches?

what's the error you get?
MASEE Solution Guide - Technical Dept Head
Most Valuable Expert 2017

Commented:
As commented above it should work.
Please post the screenshot of the error.
Actually
I was just able to figure it out after I mapped a drive to the path but was unable to get to the drive letter via the CMD prompt.

Turns out I needed to create
EnableLinkedConnection DWORD
With a value of 1 in
HKLM\software\Microsoft\windows\CurrentVersion\policies\system

Works perfect

Thank you for replying
MASEE Solution Guide - Technical Dept Head
Most Valuable Expert 2017

Commented:
Glad to know you sorted by yourself
NVITEnd-user support

Commented:
FWIW, you can also use PUSHD and POPD, which maps the drive letter to the path and makes it current. Then, POPD releases the mapped drive.

pushd "\\serverName\path1\path2"
Xcopy . "C:\programs\pathlocal1\pathlocal2" /s /e /y
popd

Open in new window

Author

Commented:
After a little more troubleshooting and research I was able to find the solution