Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two Windows 2003 servers, and I want to write a backup script on one that will copy a file to the other. What's the most idiomatic way to do this on Windows? Essentially, I'm looking for the Windows equivalent of

$ scp file.tar.gz user@host:/wherever

In response to questions: At the moment I'm only thinking about one file, a database backup. Potentially I might end up with multiple files, but I'm not that interested in rsync-like systems that track which files have changed and back up accordingly.

I'd like a solution that works with the servers on different networks, with firewalls in between. Opening up a single port on the firewall to a reasonably secure service ought not to be a problem.

share|improve this question
is it just one file you are copying ? Is it going to a backup folder, or a similar location on the other serve, ie mirroring the file or backing it up. Does it matter if the one on the other server is newer ? – cometbill Nov 18 '09 at 8:17
Are the computers on the same network in the same domain? Are there firewalls between them? – Zoredache Nov 18 '09 at 9:07
up vote 2 down vote accepted

Personally, I'd do it by mapping a drive from one server to the other and then copying the file to the mapped drive. Something like:

net use F: <\\path\to\share> /user:Username password
xcopy <file> F:
net use F: /delete

You could use robocopy instead, if you've got some more serious mirroring to do. I usually finish up by using blat or something similar to send me an email with a directory listing of the backup target, just to be sure everything made it over.

share|improve this answer
No need to map a drive either. Just "net use \\machine\share /user:Username password" (you can omit the password if it's the same as the local user), then xcopy (or robocopy), then "net use \\machine\share /delete" – Jason R. Coombs Nov 18 '09 at 13:35

copy/xcopy/robocopy and if you have the admin permissions, use the administrator shares like

share|improve this answer


share|improve this answer
Aha, and "use linux" :)) – kolypto Nov 20 '09 at 23:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.