How to Make Robocopy Completely Silent on Windows: Suppressing All Output Including Log File Confirmation


2 views

html

When automating file operations with robocopy, many developers encounter a persistent issue: despite redirecting output to nul, the tool still displays the log file location confirmation. This occurs because robocopy has multiple output streams, and the log file confirmation is handled differently than regular progress output.

The traditional approach >nul 2>&1 handles STDOUT and STDERR, but robocopy uses a separate mechanism for its final status message. Here's why your current command isn't fully silent:

robocopy source destination /mir /xd .svn /log:log.txt /np >nul 2>&1

To achieve true silence, we need to combine several techniques:

robocopy source destination /mir /xd .svn /log:log.txt /np /TEE /NJH /NJS >nul 2>&1

Key parameters added:

  • /TEE: Outputs to console window and log file (paradoxically helps with silencing)
  • /NJH: No job header
  • /NJS: No job summary

For batch file implementation, consider this robust pattern:

@echo off
setlocal
set SOURCE=C:\source_folder
set DEST=D:\backup
set LOG=C:\logs\robocopy.log

robocopy "%SOURCE%" "%DEST%" /mir /xd .svn /log:"%LOG%" /np /TEE /NJH /NJS >nul 2>&1

if %ERRORLEVEL% geq 8 (
    echo Robocopy encountered serious errors
    exit /b 1
) else (
    exit /b 0
)

For more control, you can invoke robocopy from PowerShell:

$source = "C:\source"
$dest = "D:\backup"
$log = "C:\logs\robocopy.log"

$process = Start-Process robocopy -ArgumentList @(
    ""$source"",
    ""$dest"",
    "/mir",
    "/xd",".svn",
    "/log:"$log"",
    "/np",
    "/TEE",
    "/NJH",
    "/NJS"
) -NoNewWindow -PassThru -Wait

if ($process.ExitCode -ge 8) {
    Write-Error "Robocopy failed with exit code $($process.ExitCode)"
}

When silencing output, proper error handling becomes crucial. Robocopy uses these exit codes:

  • 0-7: Success or minor issues
  • 8+: Serious errors

Always check the exit code in your automation scripts.


When automating file transfers with robocopy, many administrators want the operation to run silently without any console output. While the /log parameter successfully redirects detailed copying information to a file, robocopy still insists on printing the final log file location - a behavior that can disrupt clean automation scripts.

The standard approach of redirecting output with >nul 2>&1 works for most command-line programs, but robocopy has some special behaviors:

robocopy source dest /mir /xd .svn /log:log.txt /np >nul 2>&1

This command successfully suppresses:

  • Standard output (STDOUT)
  • Error messages (STDERR)

But fails to suppress the final log file notification.

To achieve true silence, we need to combine several techniques:

robocopy source dest /mir /xd .svn /log:log.txt /np /TEE >nul 2>&1

The key addition is the /TEE parameter which changes how robocopy handles output streams. Combined with redirection, this produces completely silent operation while still generating the log file.

For scenarios where even the above doesn't work, consider wrapping in a VBScript:

Set objShell = CreateObject("WScript.Shell")
objShell.Run "robocopy source dest /mir /xd .svn /log:log.txt /np", 0, True

The 0 parameter makes the window hidden.

Always verify your silent operation works by:

  1. Running the command in a visible console first
  2. Checking the log file contents
  3. Testing with intentional errors

Watch out for these issues when implementing silent robocopy:

  • Network timeouts may still generate popup messages
  • Insufficient permissions can cause silent failures
  • Very long paths might truncate in logs