jacksantho
jacksantho

Reputation: 391

How to copy the file from one windows machine to another windows machine in a particular drive using batch script?

In my windows server, am taking SQL DB backup in C drive. I wants to copy this .bak file to some other client windows machine in a particular drive with the current date using batch script. So that i can schedule this batch script using scheduled task. please help me out.

Can anyone, give a script to run this. thanks

Upvotes: 0

Views: 35704

Answers (1)

Ben Russell
Ben Russell

Reputation: 1423

Batch files are always tricky to get just right. First I'd open a command line and see if you can copy between two machines using the following syntax:

copy C:\localfile.bak \\remotemachine\c$\Path\remotefile.bak

(where "remotemachine" is the name of the remote machine and "c$" is the drive you wish to copy to). You can then copy this into a batch file and set up a scheduled task.

As for renaming the file to have the current date and time, I suggest you start with this question as it may involve some effort to get it into a format you want.

Upvotes: 4

Related Questions