Page 1 of 1

What does this Batch file do?

Posted: 26 Aug 2020 08:05
by Efkay
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"

Re: What does this Batch file do?

Posted: 26 Aug 2020 16:35
by ShadowThief
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.

Re: What does this Batch file do?

Posted: 26 Aug 2020 18:06
by Squashman
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.

Re: What does this Batch file do?

Posted: 27 Aug 2020 04:35
by Efkay
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.

Re: What does this Batch file do?

Posted: 27 Aug 2020 04:46
by Efkay
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.

Re: What does this Batch file do?

Posted: 27 Aug 2020 10:52
by aGerman
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

Re: What does this Batch file do?

Posted: 27 Aug 2020 13:30
by Squashman
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.

Re: What does this Batch file do?

Posted: 27 Aug 2020 15:04
by Efkay
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.

Re: What does this Batch file do?

Posted: 27 Aug 2020 19:37
by ShadowThief
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.