Share this article
Improve this guide
How to back up your files using the Command prompt
4 min. read
Updated onAugust 12, 2024
updated onAugust 12, 2024
Share this article
Improve this guide
Read our disclosure page to find out how can you help Windows Report sustain the editorial teamRead more
Regularlybacking up your Windows filesis 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 toback 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.
How can I back up files using Command Prompt?
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:
Here, replace the “source folder path” with the path of source folder in realtime; similarly for “destination folder path.” The/miroption 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/rand/wparameters will specify the number of retries and wait time in case of any errors. At the same time, the/npand/logparameters specifies the progress of the backup and maintain a log file of the backup, respectively.
For example, to copy a file ‘file1’ from theDownloadsfolder inD:drive toE:drive, the command will be something like this:
2. XCOPY
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:
Again, for example, if you want to backup an entire folder from one place, let’s say, the Downloads folder inC:drive, toE:drive, you’ll run a command that will look something like this:
The parameters/sand/vare 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:
Type the above command in Cmd and hitEnter.
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 hitEnter:
Additonally, to set a backup for your PC at a specific time, type in the following commands:
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.
To learn more about these commands, we have a greatcopy vs xcopy vs robocopyguide that should help you.
Backing up your files using the Command prompt
Keeping a regular backup of your Windows filesis 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.
Radu Tyrsina
Radu Tyrsina has been a Windows fan ever since he got his first PC, a Pentium III (a monster at that time).
For most of the kids of his age, the Internet was an amazing way to play and communicate with others, but he was deeply impressed by the flow of information and how easily you can find anything on the web.
Prior to founding Windows Report, this particular curiosity about digital content enabled him to grow a number of sites that helped hundreds of millions reach faster the answer they’re looking for.
User forum
0 messages
Sort by:LatestOldestMost Votes
Comment*
Name*
Email*
Commenting as.Not you?
Save information for future comments
Comment
Δ
Radu Tyrsina