Batch file to copy from remote desktop to local machine

Ashique Sheikh picture Ashique Sheikh · Mar 18, 2016 · Viewed 18k times · Source

How do I copy a file from a remote desktop user's drive to my local machine using xcopy or any other protocol?

My server path is \\\Trail01 and the file location is: C:\Users\ashique.sheikh\Desktop\Day2.R

How can I use this is in my batch file?

I have tried this:

net use "\\\Trail01" "Trail01@1234" "/USER:ashique.sheikh"
XCOPY /Y \\\Trail01\c:\users\ashique.sheikh\Desktop\Day2.R  "D:\VMI"

But it doesn't work, it gives a path error.

How can I download this or is there any other way to do it?

Answer

MadsTheMan picture MadsTheMan · Mar 18, 2016

Well, first of all - You can't write \\Trail01\c:\, so you should change it with \\Trail01\c$\

Try something like this...

XCOPY /Y "\\Trail01\c$\users\ashique.sheikh\Desktop\Day2.R" "D:\VMI"

Or perhaps this...

    PushD "\\Trail01\c$\users\ashique.sheikh\Desktop" &&(
XCOPY /Y Day2.R "D:\VMI"
    ) & PopD