Skip to content

Robocopy Command Builder

Build a robocopy command from checkboxes, with every switch explained, conflict and danger warnings, presets, command parsing and exit codes.

Robocopy ("robust file copy") ships with every version of Windows and Windows Server and is the standard way to copy, back up, mirror and migrate folders: it retries, resumes, keeps permissions and runs unattended. It also has about a hundred switches. Tick the options you need and the command is built as you go, with each switch explained, warnings for conflicting or dangerous combinations, and the exit code decoded when the job finishes.

Local only

Built in your browser. Your paths and options are never sent to tclient.com.

This page runs on your device (WebAssembly), so server and share names stay there. A share link is only created when you click Copy link, and it keeps everything after # in the address, which browsers never send to a server.

Start from a preset

Command

robocopy C:\Data D:\Backup\Data /E /R:2 /W:5

Paste an existing command

robocopy command, PowerShell line or .cmd file

Source, destination and files

Source folder
Destination folder
Quotes are added automatically when a path has spaces, and a trailing backslash is removed so it can't break the quoting.
Files to copy (one name or wildcard per line)

Copy options

1 selected

What gets copied and how: subfolders, metadata, moving, mirroring, scheduling and performance.

Copies subfolders, skipping empty ones.
Copies subfolders, including empty ones.
Copies only the top n levels of the folder tree.
Copies in restartable mode.
Copies in backup mode, bypassing file permissions.
Restartable mode, switching to backup mode when access is denied.
Copies with unbuffered I/O.
Copies EFS-encrypted files in their raw, still-encrypted form.
Chooses which parts of each file to copy.
Chooses what to copy for folders.
Copies files with their NTFS permissions.
Copies everything about each file.
Copies no file information.
Fixes security on all files, including ones that are otherwise skipped.
Fixes time stamps on all files, including ones that are otherwise skipped.
Deletes destination files and folders that no longer exist in the source.
Deletes
Mirrors a folder tree: copies everything and deletes what isn't in the source.
Deletes
Moves files: deletes them from the source after copying.
Removes source
Moves files and folders: deletes them from the source after copying.
Removes source
Sets attributes on the copied files.
Clears attributes on the copied files.
Creates the folder tree and empty placeholder files only.
Writes destination names in 8.3 format.
Turns off support for paths longer than 256 characters.
Keeps watching the source and copies again after n changes.
Keeps watching the source and copies again every m minutes if anything changed.
Only starts new copies between the given times.
Checks the run-hours window for each file, not each pass.
Pauses between network packets to leave bandwidth for others.
Copies junctions as junctions, not the folders they point to.
Copies symbolic links as links, not the files they point to.
Copies with several threads at once.
Copies no folder information.
Copies without Windows Copy Offload.
Asks for network compression during the copy.
Turns keeping files sparse on or off.
Doesn't try block cloning.

Copy file throttling

File selection

Retry options

2 selected

Logging options

Job options

Command

robocopy C:\Data D:\Backup\Data /E /R:2 /W:5

Switch reference

Search switches
Group
96 switches ยท Based on Microsoft Learn: robocopy

Copy options

Copy file throttling

File selection

Retry options

Logging options

Job options

Exit codes

Robocopy's exit code is a set of flags added together: 1 files copied, 2 extra files, 4 mismatches, 8 failures, 16 fatal error. Anything below 8 is success, which is why a scheduled task can show "0x1" or "0x3" for a copy that worked.

Exit code (%ERRORLEVEL% or $LASTEXITCODE)
Success: files were copied.
BitSet?Meaning
1 Yes Files copied: One or more files were copied.
2 No Extra files: The destination has files or folders that aren't in the source (deleted with /PURGE or /MIR, otherwise just reported).
4 No Mismatches: Some files or folders didn't match their counterpart (for example a file in one place and a folder of the same name in the other).
8 No Failures: Some files or folders couldn't be copied, even after the retries (/R).
16 No Fatal error: Robocopy couldn't do the job at all: an invalid option, or no access to the source or destination. Nothing was copied.
Codes 0 to 7 all mean success. Scripts and schedulers that treat any non-zero exit code as an error will report a good copy as failed: check for 8 or more instead (if %ERRORLEVEL% GEQ 8, or $LASTEXITCODE -ge 8). Microsoft documents codes 0 to 8 (Microsoft Learn: return codes used by Robocopy); 16 isn't in its tables but is what robocopy returns when it can't run the job at all.

Common gotchas

A trailing backslash inside quotes breaks the command

Windows reads \" as an escaped quote, so in robocopy "C:\My Data\" D:\Backup robocopy receives one argument, C:\My Data" D:\Backup, and complains about a missing destination or an invalid parameter. Leave the trailing backslash off ("C:\My Data"); this builder does it for you.

/MIR in the wrong direction

Robocopy is always source, then destination. Swap them with /MIR and the backup overwrites the live data: files that exist only in the real source are deleted, and changed files are replaced by the backup's older copies. Run with /L first and read the lines marked *EXTRA File: those are the files it would delete.

/MT together with /Z

They work together, but restartable mode records progress inside every file, which eats into the gain from parallel threads. For many small files use /MT alone; keep /Z (or /ZB) for large files over links that drop.

Scheduled tasks behave differently from your prompt

A task runs as its own account, without your mapped drives (use \\server\share paths) and, unless "Run with highest privileges" is ticked, without administrator rights, so /B and /ZB fail with access denied. The task's "last result" is robocopy's exit code: 1 or 3 means success. The .cmd download turns codes below 8 into 0.

Log files and character sets

/LOG writes in the console's old code page, so names with accents or other scripts turn into question marks. /UNILOG writes UTF-16, which is correct but looks double-spaced in tools that expect UTF-8. /LOG also replaces the file each run; use /LOG+ to keep history, and /NP so the percentage counter doesn't fill the log.