Automatically Backup User Data in Windows XP

· Windows Scripts

The script will automatically backup all the user files in My Documents, Desktop, Favorites, and the default PST location.

How to run a batch script: Save the below code in an *.CMD file. Replace FILESERVER with the name of your file server and ensure there is a share called “users” and inside a user that matches the username. The scripts will create a new folder called “AutoRecovered” and save all files to that location.

REM This script will automatically backup all user files in My Documents, Desktop,
REM Favorites, and the PST location.
REM NOTE ************************
REM Please check the computer for user saves files outside of the default locations
REM like the root of the C drive.
REM NOTE ************************
REM Source:
REM Source:
ECHO *****************************
ECHO *** Automated User Backup ***
ECHO *****************************
set INPUT=
set /P INPUT=Please enter in the username to backup: %=%
if "%INPUT%"=="" goto input
ECHO Mapping to Network Drive with Domain Administrator Account
net use Z: \\FILESERVER\users\%INPUT% /User:DOMAINadministrator *
ECHO Creating AutoRecovered Directory in \FILESERVERusers%INPUT%
mkdir Z:\AutoRecovered
ECHO Copying "My Documents" for %INPUT%
xcopy "C:Documents and Settings\%INPUT%\My Documents" "Z:\AutoRecovered\My Documents" /s /c /h
ECHO Copying "Favorites" for %INPUT%
xcopy "C:Documents and Settings\%INPUT%\Favorites" "Z:\AutoRecovered\Favorites" /s /c /h
ECHO Copying "Desktop" for %INPUT%
xcopy "C:Documents and Settings\%INPUT%\Desktop" "Z:\AutoRecovered\Desktop" /s /c /h
ECHO Copying "Email PSTs" for %INPUT%
xcopy "C:Documents and Settings\%INPUT%\Local Settings\Application Data\Microsoft\Outlook\*.pst" "Z:\AutoRecoveredEmail" /s /c /h
ECHO Operation Complete
author image

About Joseph Spurrier

I'm passionate about building solutions to automate tasks and improve efficiency. I worked for a few companies in the digital healthcare space. My education is in forensics. Tech guy. Traveler. Runner. Guitar player. Scotch and beer enthusiast. GitHub LinkedIn Twitter Google+

Share this post

Comments powered by Disqus