user1764810
user1764810

Reputation: 13

.BAT Copying file - same directory different drive

How would i go about writing a .bat file, so that i can drag and drop a file onto it in windows 7, that would copy the file to the same directory, but on a different drive?

So if my file was:

D:\Files\Newfiles\File01.jpg

It would copy it to a prespecified network location (COMPUTER_01):

\\COMPUTER_01\Files\Newfiles\File01.jpg

I've looked into using command line parameters %~p1 and %~nx1, but i'm not sure how these would be implemented.

I'm sure this is painfully easy to do but I have no idea!

Upvotes: 1

Views: 235

Answers (1)

Joey
Joey

Reputation: 354864

Painfully easy it is:

copy %1 "\\COMPUTER_01%~p1"

Upvotes: 1

Related Questions