How to back up your files using the Command prompt

Reading time icon 4 min. read

Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

Regularly backing up your Windows files is as essential as having a routine Windows update. This is because a backup not only protects you from random data corruption, which can creep on your PC for a myriad of reasons, but it also keeps a check on the loss of data caused by human errors, malware attacks, and so on.

We’ve previously covered how to back up your files using the System Restore, File History, etc. But that’s not all. Yet another, more straightforward method will do the job just as well; we’re, of course, talking about the Command prompt. 

Command prompt offers you a slew of commands to ehlp you create a backup for your files.

Let’s go over all of them one by one.

1. Robocopy

The Robocopy command is a handy Cmd command that can copy any of your Windows files with ease. 

With Robocopy you can copy all the files or subdirectories from the source folder to the destination folder, including empty directories.

To backup your files using the Robocopy command, run the following snippet in Command prompt and hit Enter:

robocopy "source folder path" "destination folder path"/e /mir /r:1 /w:1 /np /log: "log file path"

Here, replace the “source folder path” with the path of source folder in realtime; similarly for “destination folder path.” The /mir option will then mirror the source folder to the destination folder; this means the destination folder will also delete any deleted files from sources.

Also, the /r and /w parameters will specify the number of retries and wait time in case of any errors. At the same time, the /np and /log parameters specifies the progress of the backup and maintain a log file of the backup, respectively.

For example, to copy a file ‘file1’ from the Downloads folder in D: drive to E: drive, the command will be something like this:

robocopy D:\Downloads\file1 E:\ /MIR


Yet another powerful tool offered by Command prompt, the XCOPY command copies your files from one location to another. This command is handy in copying all files and subdirectories from the source folder to the destination folder, including any files and empty directories.

To run the XCOPY command, use the following format:

xcopy /s /e /h /i /y "source folder path" "destination folder path"

Again, for example, if you want to backup an entire folder from one place, let’s say, the Downloads folder in C: drive, to E: drive, you’ll run a command that will look something like this:

xcopy C:\Users\shaantminhas\Downloads E:\ /s /v

The parameters /s and /v are useful for copying directories and subdirectories and verifying each downloaded file respectively.

3. Wbadmin

Want to back up your operating system files to protect them from random corruptions and errors? 

The Wbadmin will come to your rescue here, letting you back up and quickly restore your operating systems, volume, files, or application.

Here’s how to create a backup with Wbadmin in Command prompt:

wbadmin start backup -backupTarget:<BackupDrive>: -allCritical -systemState -quiet

Type the above command in Cmd and hit Enter.

From above, replace the “BackupDrive” with the drive letter or network location where you’d like to store the backup on your PC.

 You can back up a specific file or folder with Wbadmin as well. For example, to create a backup of your drive D: in your drive F:, type in the following command and hit Enter:

wbAdmin start backup -backupTarget:D: -include:F: -allCritical -quiet

Additonally, to set a backup for your PC at a specific time, type in the following commands:

wbadmin enable backup -addTarget:<BackupDrive>: -schedule:00:00 -quiet

Here, replace “BackupDrive” with the drive letters or network letters where you’d like to store your data, and “00:00” with the time you want to perform this backup.

You can explore many other combinations like this, with the help of different parameters.

Backing up your files using the Command prompt

Keeping a regular backup of your Windows files is as essential as getting regular, timely updates for your PC. Following some of the above commands, you can back up your files using the Command prompt for good in no time as well.