Ashique Sheikh
Ashique Sheikh

Reputation: 155

How to give right path in .bat file to copy file from windows server to local windows

Hi I am making a batch file that will copy a file from the users c drive of a server to the local machine.

This is what i have so far.

net use "\\\Trail01" "trail@1234" "/USER:ashique.sheikh"

XCOPY /Y "\\\Trail01\c:\Users\ashique.sheikh\Desktop\Day2.R"  "D:\newfolder"

My server name is \\Trail01.

The file path is c:\Users\ashique.sheikh\Desktop\Day2.R.

Upvotes: 1

Views: 1005

Answers (1)

Dewi Jones
Dewi Jones

Reputation: 825

Try this, you will need the admin credentials for the net use though as the C drive is an administrative share

net use N: \\trail01\c$ trail@1234 /USER:ashique.sheikh

XCOPY /Y "N:\Users\ashique.sheikh\Desktop\Day2.R" "D:\newfolder"

Upvotes: 1

Related Questions