What does this Batch file do?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Efkay
Posts: 4
Joined: 26 Aug 2020 07:44
Location: France

What does this Batch file do?

#1 Post by Efkay » 26 Aug 2020 08:05

The following is a batch file I propose to run on my Windows 7 Pro platform with a view to backing up my data files, prior to installing Windows 10.

I can see that having chosen the correct drive letter where the backup will be stored it goes on to backup the data from the Desktop, Documents, Downloads, Favorites, Music, Pictures and Videos - but am at a loss to know what else it's going to do.

Would someone please be kind enough to advise me.

Thanks in advance.

Code: Select all

REM *********************************************************
REM Backup User Profile
REM Replace everywhere below that has D:\ with the drive letter of the USB device.
REM If USB Drive is E:\ then replace D:\ with E:\
REM *********************************************************
ROBOCOPY "%SystemDrive%\Desktop" "D:\ProfileBackup\Desktop"  /MIR /R:2 /W:5 /XJ /MT:32 /FFT /XF *.ost /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\Documents" "D:\ProfileBackup\Documents" /MIR /R:2 /W:5 /XJ /MT:32 /FFT /XF *.ost /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\Downloads" "D:\ProfileBackup\Downloads"  /MIR /R:2 /W:5 /XJ /MT:32 /FFT /XF *.ost /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\Favorites" "D:\ProfileBackup\Favorites" /MIR /R:2 /W:5 /XJ /MT:32 /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\Music" "D:\ProfileBackup\Music" /MIR /R:2 /W:5 /XJ /MT:32 /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\Pictures" "D:\ProfileBackup\Pictures"  /MIR /R:2 /W:5 /XJ /MT:32 /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\Videos" "D:\ProfileBackup\Videos"/MIR /R:2 /W:5 /XJ /MT:32 /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\AppData\LocalLow\Google\GoogleEarth" "D:\ProfileBackup\AppData\LocalLow\Google\GoogleEarth" /MIR /R:2 /W:5 /XJ /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\AppData\Local\Microsoft\Outlook" "D:\ProfileBackup\AppData\Local\Microsoft\Outlook" /MIR /R:2 /W:5 /XJ /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User\Default\Favorites" "D:\ProfileBackup\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User\Default\Favorites" /MIR /R:2 /W:5 /XJ /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User\Default\DataStore" "D:\ProfileBackup\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User\Default\DataStore" /MIR /R:2 /W:5 /XJ /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\AppData\Roaming\Microsoft\Signatures" "D:\ProfileBackup\AppData\Roaming\Microsoft\Signatures" /MIR /R:2 /W:5 /XJ /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\AppData\Roaming\Microsoft\Stationery" "D:\ProfileBackup\AppData\Roaming\Microsoft\Stationery" /MIR /R:2 /W:5 /XJ /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\AppData\Roaming\Microsoft\Word\STARTUP" "D:\ProfileBackup\AppData\Roaming\Microsoft\Word\STARTUP" /MIR /R:2 /W:5 /XJ /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\AppData\Roaming\Microsoft\Excel\XLSTART" "D:\ProfileBackup\AppData\Roaming\Microsoft\Excel\XLSTART" /MIR /R:2 /W:5 /XJ /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\AppData\Roaming\Microsoft\Document Building Blocks" "D:\ProfileBackup\AppData\Roaming\Microsoft\Document Building Blocks" /MIR /R:2 /W:5 /XJ /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\AppData\Local\Google\Chrome\User Data\Default" "D:\ProfileBackup\AppData\Local\Google\Chrome\User Data\Default" /MIR /R:2 /W:5 /XJ /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
ROBOCOPY "%SystemDrive%\AppData\Roaming\FileZilla" "D:\ProfileBackup\AppData\Roaming\FileZilla" /MIR /R:2 /W:5 /XJ /FFT /LOG+:"D:\ProfileBackup\RoboCopyBackupLog.txt"
Last edited by aGerman on 26 Aug 2020 12:29, edited 1 time in total.
Reason: code formatting

ShadowThief
Expert
Posts: 1160
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: What does this Batch file do?

#2 Post by ShadowThief » 26 Aug 2020 16:35

Good news, there's a grand total of two unique commands in that script, so this is going to be super fast.

Code: Select all

REM
is a comment. It does nothing.

Code: Select all

ROBOCOPY
copies files from a source folder to a destination folder.
/MIR copies any subdirectories as well
/R:2 retries twice if errors are encountered
/W:5 waits 5 seconds between retries
/XJ excludes any symbolic links
/MT:32 uses 32 threads for multi-threaded copying
/FFT uses timestamps that are compatible with FAT file systems
/XF *.ost excludes files with the .ost extension
/LOG+ appends to a log file

All commands have a /? option that you can use to learn what they do.

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: What does this Batch file do?

#3 Post by Squashman » 26 Aug 2020 18:06

I hate to be one of those people who say RTM, but you should read the the help file first and then ask a question as to what you don't understand about the description in the help file.

Efkay
Posts: 4
Joined: 26 Aug 2020 07:44
Location: France

Re: What does this Batch file do?

#4 Post by Efkay » 27 Aug 2020 04:35

Squashman: I apologise unreservedly for falling at the first hurdle and eliciting your wrath. However, I did read several of the articles in the DOS Batch Guide, but it was like going into an exam for History and being presented with a paper on Newtonian and Relativistic Mechanics, I just glazed over.

Efkay
Posts: 4
Joined: 26 Aug 2020 07:44
Location: France

Re: What does this Batch file do?

#5 Post by Efkay » 27 Aug 2020 04:46

ShadowThief: Thank you for taking the trouble to respond and indeed I have gained a tad more information.

In the end I ran the file only to receive multiple error messages, so I guess I'll abandon continuing on that route.

My thanks once more.

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: What does this Batch file do?

#6 Post by aGerman » 27 Aug 2020 10:52

The error messages may appear due to the fact that some of the folders that the script wants to backup just don't exist on your machine. But that's something we're not able to tell because we can't check this remotely and you didn't share the error messages you received. The latter would have been an easy task. The first is rather something you have to do by yourown.

Steffen

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: What does this Batch file do?

#7 Post by Squashman » 27 Aug 2020 13:30

Efkay wrote:
27 Aug 2020 04:46
ShadowThief: Thank you for taking the trouble to respond and indeed I have gained a tad more information.
You essentially were given what is in the help file for the Robocopy command which you could have read yourself.

Efkay
Posts: 4
Joined: 26 Aug 2020 07:44
Location: France

Re: What does this Batch file do?

#8 Post by Efkay » 27 Aug 2020 15:04

Squashman: I'm saddened to note that you haven't grasped the fact that some people join a forum to ask for help because they are out of their depth in a particular topic. I happen to be one of those people and reading the equivalent of gobbedygook in a help file aimed at budding geeks, did nothing to enlighten me.

Whilst both ShadowThief and aGerman have both been informative, your presence and attitude precludes my continuance with this topic so will seek help elsewhere.

ShadowThief
Expert
Posts: 1160
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: What does this Batch file do?

#9 Post by ShadowThief » 27 Aug 2020 19:37

Squashman wrote:
27 Aug 2020 13:30
Efkay wrote:
27 Aug 2020 04:46
ShadowThief: Thank you for taking the trouble to respond and indeed I have gained a tad more information.
You essentially were given what is in the help file for the Robocopy command which you could have read yourself.
If you want to read the help file, you first have to know the help file exists.

Post Reply