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.

@ECHO OFF
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: http://www.computing.net/answers/dos/making-a-bat-file-to-get-input/12821.html
REM Source: http://wp.me/p6h4z-1g
ECHO *****************************
ECHO *** Automated User Backup ***
ECHO *****************************
ECHO.
:input
set INPUT=
set /P INPUT=Please enter in the username to backup: %=%
if "%INPUT%"=="" goto input
ECHO.
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.
ECHO Copying "My Documents" for %INPUT%
xcopy "C:Documents and Settings\%INPUT%\My Documents" "Z:\AutoRecovered\My Documents" /s /c /h
ECHO.
ECHO Copying "Favorites" for %INPUT%
xcopy "C:Documents and Settings\%INPUT%\Favorites" "Z:\AutoRecovered\Favorites" /s /c /h
ECHO.
ECHO Copying "Desktop" for %INPUT%
xcopy "C:Documents and Settings\%INPUT%\Desktop" "Z:\AutoRecovered\Desktop" /s /c /h
ECHO.
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.
ECHO Operation Complete
ECHO.
PAUSE
author image

About Joseph Spurrier

I'm passionate about building solutions to automate tasks and improve efficiency. Tech guy. Traveler. Runner. Guitar player. Scotch and beer enthusiast. Keybase GitHub Gists LinkedIn Twitter

Share this post


Comments powered by Disqus