Backing up specific important folders, files and documents in Windows 11 does not require expensive third-party software when you know how to use the command line.

Image: Pexels

Microsoft Windows 11 includes several features and applications for backing up system files, but very few for backing up specific important user-created files and folders. Generally, this is because Microsoft wants users to take advantage of the benefits of OneDrive and their other cloud apps inside Azure.

But what do you do if you cannot connect to the cloud and still need to backup important files?

SEE: How to secure your email via encryption, password management and more (TechRepublic Premium)

Many years ago, back when personal computers ran on DOS and command line interfaces, users took advantage of a file copying and moving application called xcopy. This pre-Windows app is still available in the command-line structure of Windows 11, but the mysteries of how it works have been lost to many by the allure of the modern graphical user interface.

How to use xcopy

The purpose of the xcopy application is relatively simple to understand: Copy or move files and folders from one location to another. Complications arise from the various parameters and switches available in even the most basic xcopy command. The basics of the xcopy command are laid out in this excerpt from Microsoft Docs:

xcopy <Source> [<Destination>] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/g] [/d [:MM-DD-YYYY]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [{/a | /m}] [/n] [/o] [/x] [/exclude:FileName1[+[FileName2]][+[FileName3]]] [{/y | /-y}] [/z] [/b] [/j]

As you can see, the xcopy command line can get very complicated very quickly depending on what you would like it to do. Many IT Pros made careers on their ability to create DOS batch files that could create backup copies of files and move them to safer storage devices.

Our example xcopy command will be much simpler and straightforward. We are going to create an xcopy command that will copy all the files and subfolders in your standard Windows 11 Documents folder onto a USB thumb drive.

The first hurdle we must overcome is the full path to our source. The xcopy app only responds to valid input, so we must be precise.

If you open Windows Explorer and navigate to your source folder – in our example, that is the Documents folder for the current user – and right click the address sequence, as shown in Figure A, you will be given the option to copy the path as text to the Windows 11 clipboard.

Figure A

Image: Mark Kaelin/TechRepublic.

For our example, that path is:


Our destination path will be a folder on the USB thumb drive named E:\Backup.

To make sure we copy the Document folder and all the files and subfolders it contains to the thumb drive, we will use these parameters:

  • /s – Copies directories and subdirectories, unless they are empty. If you omit /s, xcopy works within a single directory.
  • /v – verifies each copied file and folder.
  • /a – copies files with the archive attribute set (archived files will be copied).

With those parameters, our xcopy command will look like this:

xcopy C:\Users\mark\Documents E:\Backup /s /v /a

To use the xcopy app, type cmd into the Windows 11 desktop search tool and select the Command Prompt app from the list of results. Type or paste the xcopy command into the prompt and press Enter.

Depending on the number of files, the process could take a matter of seconds or several minutes. Figure B shows what our simple example command looks like.

Figure B

Image: Mark Kaelin/TechRepublic.

When you compare the source folder with the destination folder after running the xcopy app, as shown in Figure C, you can see that we copied the appropriate files and folders, leaving out the empty folder. If we wanted to include the empty folder, we could add the /e switch to our command.

Figure C

Image: Mark Kaelin/TechRepublic.

The xcopy command, depending on the location of the destination of course, will work even if you do not currently have internet access. The xcopy command also does not limit the number of folders or files nor does it limit the size of those files — it just copies everything it is told to copy. This can be a powerful tool to employ in a shutdown batch file when you want to save documents on a removable storage device at the end of each work session.