Ashique Sheikh
Ashique Sheikh

Reputation: 155

Batch file to copy from remote desktop to local machine

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?

Upvotes: 5

Views: 26061

Answers (3)

Chetna rustagi
Chetna rustagi

Reputation: 481

Command1: net use "\172.17.0.27" typePassword /user:domain\typeUsername
Command2: XCOPY /Y "\172.17.0.27\C$\Reports\hello.txt" "C:\Trades_Backup"

Command1 : It is going to access ip 172.17.0.27
Command2 : It is going to copy hello file from Reports folder of this ip to TradesBackup folder of your local system

Upvotes: 0

Manuel
Manuel

Reputation: 46

In most cases, the access of drive c via network (\\Trail01\c$) is only allowed to administrators.

First of all you can check if you have the necessary rights to map the share \\Trail01\c$ (explorer >> map network drive).

If this is not possible, maybe you can try to create a new share when you are in a remote session on the server. Right-Click on the folder which you need access (in your case "c:\Users\ashique.sheikh\Desktop\Day2.R") in explorer >> properties >> sharing >> Advanced sharing.

If you could create a new share (which is called for example specialshare), please try to access via \\Trail01\specialshare.

Is this possible?

Upvotes: 2

MadsTheMan
MadsTheMan

Reputation: 703

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

Upvotes: 3

Related Questions