Backup User Profiles to a Network Folder

After searching online for a few days I couldn’t find a batch file that would backup a users My Documents, Desktop, and Favorites for both XP and Windows 7  to their own personal network folder. Of course this script can be altered to backup anywhere you would like. Example – external hard drive, flash drive, local machine….

So below is the script and you can download the batch along with the excluded file.

Note: The batch file and the exclude file must be in the same directory/folder. If you don’t wish to exclude files remove “/EXCLUDE:excludebackupcopy.txt”.

 

:: Quick Backup by Cory Fiala

@echo off
:: variables
set drive=x:Backup
set backup=xcopy /s /c /d /e /i /r /k /y /EXCLUDE:excludebackupcopy.txt

ver |find ” 6.”>nul && (set pname=Documents) || (set pname=My Documents)

echo Quick Backup
echo.
echo This program will back the following: User Desktop, My Documents, Favorites, and the current folder which this batch file lives.
echo.
echo.
echo :::Files to be Excluded:::
echo.
echo Audio: .mp3 .mp4 .wav .aiff .flac .aif .m3u .m4a .wma .mpa
echo Video: .mov .avi .mp4 .mov .mkv .mpg .wmv .3gp .flv .vob
echo Misc : .exe /vmdk .vmem
echo.
echo.
PAUSE

echo ### Backing up current folder…
%backup% “%cd%” “\BOWSERSTOWERStaff Backups%USERNAME%”

echo ### Backing up Desktop…
%backup% “%USERPROFILE%Desktop” “\file1staffhome%USERNAME%Desktop”

echo ### Backing up My Documents…
%backup% “%USERPROFILE%%pname%” “\file1staffhome%USERNAME%%pname%”

echo ### Backing up Favorites…
%backup% “%USERPROFILE%Favorites” “\file1staffhome%USERNAME%Favorites”

echo Backup Complete!
@pause

 

[button link=”https://www.coryfiala.com/wp-content/uploads/2012/08/QuickBackup-Batch-File1.rar” type=”icon”] Downlaod[/button]

3 thoughts on “Backup User Profiles to a Network Folder”

  1. Hello,

    When I try the ver |find ” 6.”>nul && (set pname=Documents) || (set pname=My Documents) command, it gives me “invalid number of parameters”.

    Any ideas?

    Thank you!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top