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 This program will back the following: User Desktop, My Documents, Favorites, and the current folder which this batch file lives.
echo :::Files to be Excluded:::
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 ### 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!


Show More

Cory Fiala

Technology and outdoor enthusiast. Currently the sole systems administrator for a local K-12 school district with 800+ staff and 5,500+ students. I support windows servers (2012R2-2022), Linux systems (FreeBSD and Ubuntu), along with vSphere (4 node cluster). Total is almost 60 virtual machines and 8 physical servers. This doesn't include my personal homelab.


  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 Reply

Your email address will not be published.

Back to top button