
Turn off startup programs on Windows 10 and 11 with Task Manager and Settings, then by command prompt and PowerShell, and on many PCs at once.
Back up files on Windows 10 and 11 from Command Prompt with robocopy, xcopy and wbadmin, plus a ready-to-use backup script you can schedule.


Content writer, trio.so
The quickest way to back up files from Command Prompt is robocopy. Open Command Prompt and run robocopy C:\Data D:\Backup /E /R:2 /W:5 /LOG:D:\Backup.log. It copies the folder and every subfolder, retries a failed file twice, and writes a log. Use xcopy for a simple one-off copy and wbadmin for a system or volume backup. All three work on Windows 10 and Windows 11.
| Command | Use it for | Watch out for |
|---|---|---|
robocopy | Folder backups you repeat. Retries, logging, only changed files. | /MIR deletes files at the destination. |
xcopy | A quick copy of a folder tree. | No log file and no retry control. |
wbadmin | Volume and system backups to a drive or network share. | Needs a Command Prompt run as administrator, and an account in Administrators or Backup Operators. |
None of these is a backup by itself until a copy lives on a different disk or machine. Back up to an external drive or a network share, never to a second folder on the same disk.
Robocopy ships with Windows 10 and 11. Syntax: robocopy <source> <destination> [options].
robocopy C:\Data D:\Backup\Data /E /R:2 /W:5 /LOG:D:\Backup\backup.log
/E copies all subfolders, including empty ones./R:2 /W:5 retries a failed file twice and waits 5 seconds between tries. The default is a million retries at 30 seconds each, which can make a script look hung on a locked file./LOG:file writes the result to a file. Use /LOG+:file to append./MT:8 copies with 8 threads for speed on many small files. Use it with a log file./NP hides the per-file progress percentage so the log stays short./XD folder skips a folder, for example a temp folder./Z makes copies restartable, which helps over a slow network share.By default robocopy skips files that are the same in both places, so the second run only copies what changed.
/MIR mirrors the source to the destination. It is /E plus /PURGE, which deletes files in the destination that no longer exist in the source. If you delete a file from the source by accident, the next mirror run deletes your backup copy too. If you use /MIR, run it once with /L first. That lists what would happen without copying or deleting anything.
robocopy C:\Data D:\Backup\Data /MIR /L /R:2 /W:5
Robocopy returns a code, not just success or fail. Per Microsoft, 0 means nothing needed copying, 1 means files were copied, and any value of 8 or higher means at least one failure. A script should treat 0 to 7 as success and 8 or above as an error.
Xcopy is older and has fewer options, but it is fine for a quick copy of a folder tree:
xcopy C:\Data D:\Backup\Data /S /E /H /I /Y
/S /E copies subfolders, including empty ones./H includes hidden and system files./I treats the destination as a folder if it does not exist./Y overwrites without asking./D with no date copies only files newer than the ones already in the destination.Microsoft notes that xcopy can fail with an "insufficient memory" error on paths longer than 255 characters. Robocopy does not have that limit by default.
wbadmin is the command line for Windows backup. Open Command Prompt as administrator (right-click, Run as administrator). Your account must be in Administrators or Backup Operators.
wbadmin start backup -backupTarget:E: -include:C: -allCritical -quiet
-backupTarget is the drive letter or network share (\\server\share) to write to.-include lists the volumes, folders or files to back up.-allCritical adds every volume the operating system needs, for a bare metal restore. The target cannot be one of the volumes in the backup.-quiet runs without prompts, which a scheduled job needs.Two cautions from Microsoft's documentation. A second backup to the same network share overwrites the first, so use a subfolder per run. And a failed run can leave you with an unusable newest backup and no older one. For everyday file backups, robocopy is easier to read and recover from.
Save this as C:\Scripts\backup.ps1. It copies one folder, writes a dated log and exits with an error code if robocopy reports a failure.
$src = "C:\Data"
$dst = "D:\Backup\Data"
$log = "D:\Backup\logs\backup-$(Get-Date -Format yyyy-MM-dd).log"
New-Item -ItemType Directory -Force -Path (Split-Path $log) | Out-Null
robocopy $src $dst /E /R:2 /W:5 /MT:8 /NP /LOG:$log
if ($LASTEXITCODE -ge 8) { exit 1 } else { exit 0 }
Set the source and destination, run it once by hand, and open the log to confirm the file count.
From a Command Prompt run as administrator, this creates a task that runs the script every night at 2:00 as the SYSTEM account:
schtasks /create /tn "Nightly File Backup" /tr "powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:\Scripts\backup.ps1" /sc daily /st 02:00 /ru SYSTEM /rl HIGHEST
Run it once on demand with schtasks /run /tn "Nightly File Backup", then check the log. If the destination is a network share, SYSTEM uses the computer's identity on the share, so give the computer account write access or run the task under a service account.
Before you rely on any backup, restore a few files from it. A backup you have never restored is a guess. For restore points on the system drive, see how to enable System Protection from Command Prompt. To stop heavy apps from slowing the machine while it runs, see how to disable startup programs from Command Prompt.
A script on one PC is a chore. On fifty it is a project. trio.so runs scripts on enrolled Windows PCs from the console, so you can write the robocopy backup script once and run it on the machines that need it. See remote terminal and script runs.

trio.so runs scripts on enrolled Windows PCs from the console.
trio.so brings device management, patching and security policies for Windows, macOS, Linux, iOS/iPadOS and Android into one console. Enroll a device and see it in the console within minutes.
trio.so brings device management, patching and security policies for Windows, macOS, Linux, iOS/iPadOS and Android into one console. Enroll a device and see it in the console within minutes.





Have questions? We've got answers. This section covers some of the most commonly asked questions related to this topic.
robocopy C:\Data D:\Backup /E /R:2 /W:5 /LOG:D:\Backup.log to copy a folder and its subfolders to another drive and log the result.wbadmin start backup writes volumes, folders or a system image to a drive or network share, and it must run from a Command Prompt opened as administrator.schtasks /create with /sc daily /st 02:00 runs your backup script every night at 2:00./L first to see what it would do.Related
The related industry news, interviews, technologies, and resources.

Turn off startup programs on Windows 10 and 11 with Task Manager and Settings, then by command prompt and PowerShell, and on many PCs at once.

Discover how to use Event Logs on Windows for improved IT management, security, and compliance. Learn practical applications and best practices.

Enhance system security with virtual memory pagefile encryption. Learn about best practices and how a simple solution can help simplify your IT management.

Learn how to change the boot logo in Windows 10, customize the startup icon, and streamline the process with a simplified MDM solution.

Wondering how to protect corporate data on Windows devices? Discover why implementing MDM for Windows is essential for security and productivity.

Windows could not automatically detect this network's proxy settings? Fixes for Windows 10 and 11 in order, plus how policy-pushed proxies cause it.

What Windows Autopilot is, how it works, what it costs, how to set it up step by step, and how to use it with an MDM other than Intune.

Learn how windows provisioning simplifies device management for IT admins, offering comprehensive configurations for businesses of all sizes.
14-day free trial. No credit card required.
trio.so for MSPs: one console, separate clients