5

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?

SiHa
  • 7,830
  • 13
  • 34
  • 43
Ashique Sheikh
  • 155
  • 2
  • 4
  • 13
  • 1
    What is the error you're getting? And is it correct that you want to copy the file `day2.r` from `\\Trail01\c:\users\ashique.sheikh\Desktop\ ` to `D:\VMI`? It sounds wrong to have \\servername\c:\, so I think I've misunderstood something or there is something wrong with the actual path. – MadsTheMan Mar 18 '16 at 07:18
  • Yes i want to copy day.r from server to my local D drive. when I take remote login I can see the file in c:\users\ashique.sheikh\Desktop\ of \\Trail01 so how can i download it from server directly? – Ashique Sheikh Mar 18 '16 at 08:59

3 Answers3

3

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
MadsTheMan
  • 705
  • 1
  • 10
  • 32
  • It shows XCOPY /Y "\\Trail01\c$\users\ashique.sheikh\Desktop\Day2.R" "D:\VMI" Invalid drive specification and in PushD "\\Trail01\c$\users\ashique.sheikh\Desktop" &&( XCOPY /Y Day2.R "D:\VMI" ) & PopD shows Access is denied. How can these show access is denied in this i used net use "\\Trial01" "Trial@1234" "/USER:ashique.sheikh" PushD "\\Trial01\c$\users\ashique.sheikh\Desktop" &&( XCOPY /Y Day2.R "D:\VMI" ) & PopD – Ashique Sheikh Mar 18 '16 at 09:16
  • What station is your server (Trail01) mapped to? – MadsTheMan Mar 18 '16 at 09:27
  • It is windows server 2012 R. Can i use putty or any other protocol in it? – Ashique Sheikh Mar 18 '16 at 09:33
  • I mean what station. As in your VMI folder is in a `D:\` station. What station is your Trail01 server? Since you've net used it, it should have a station. – MadsTheMan Mar 18 '16 at 09:47
  • It is just a remote server . I connect it with remote desktop connection by typing Trial01 only and it asked for username and password – Ashique Sheikh Mar 18 '16 at 10:07
  • I'd put `popd` in between the parentheses too, because if `pushd` fails, no `popd` should be done (think of nested `pushd`/`popd` pairs)... – aschipfl Mar 18 '16 at 10:20
2

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?

Manuel
  • 46
  • 1
  • 5
0

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

Chetna rustagi
  • 463
  • 7
  • 21