A few words of thanks would be greatly appreciated.

Windows - Incremental backup of data with .BAT (Batch)


Data Loss is a big issue associated with formatting your computer. In this cases it is good to know that Windows comes with backup and recovery solutions which can prevent this unexpected problems. We can use incremental backup to save important data in the computer before formatting. The Backup Utility of Windows systems supports this type of backup which saves all files that have changed since the last one and prevents data loss. One can launch this file to copy data from the C to D drive by saving the file extension name as .bat.

Use of incremental backup

Incremental backup can be used to save your important data before you format your computer.

  • During the first batch launch, all the files and folders are saved and when relaunched after 2-3 weeks, all the changes made are saved.

  • In the example below the files are copied from root C to the backup folder on the partition D.

    • "% USERPROFILE%" is the variable of "Documents and Settings \ username". The switches: "E / H / R / Y / I / D", are used to copy the system 's hidden files.

For more information, open the command prompt (cmd.exe) and type: xcopy/?.


  • First, open the notepad and copy:

@echo off        
xcopy C:\Docs D:\Backup\Docs /E /H /R /Y /I /D
xcopy "%USERPROFILE%"\Favoris D:\Backup\Favoris /E /H /R /Y /I /D
  • Then click on "File > Save as", name the file extension as name.bat (the name is optional) and select file type as all files

  • Launch the file to copy the data from C to D

Note: Depending on your needs, you can change the letters of drives in the script.

Image: © Everypixel


A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Windows - Incremental backup of data with .BAT (Batch) », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).