• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 419
  • Last Modified:

Need script to copy & replace a backup file on Windows PC to Windows server.

I need a script to copy a backup file from a Windows XP computer to a Windows server 2008 by using the task manager on the XP computer....rough mapping would be...




The XP computer is on a domain with access to the server.

Also need the script to overwrite the previously backed up file on the server. Thx.
1 Solution
Hi Wilmette

How's this?

Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "\\UserPC\deptfile\backup\backup.bak" , "\\server\data\dept\backup\", OverwriteExisting


Alternatively, you could have your task run this line of code without needing a script:
echo F | xcopy /y /f /i \\UserPC\deptfile\backup\backup.bak \\server\data\dept\backup\backup.bak

Open in new window

Bill PrewCommented:
Save this as a BAT file, and then create a scheduled task in Windows task scheduler to run it at the desired time and frequency.

@echo off
set CopyFile=\\UserPC\deptfile\backup\backup.bak
set DestDir=\\server\data\dept\backup
if not exist "%DestDir%\" md "%DestDir%\"
xcopy /y "%CopyFile%" "%ToDir%\"

Open in new window

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

If you need a good solid tool for this type of oPeration, then you can try Robocopy from the 2003 Resource Kit.
WilmetteAuthor Commented:
Thanks for the replies. I forgot to explain that the script will be run daily in MS Task Manager.
WilmetteAuthor Commented:
I should say...Task Scheduler not Task Manager...ooops
You can use either solution by creating an executable scripted file and then calling that file from the MS Scheduled Task.

Do you need the code for the function you requested above?

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now