Robocopy Broken
See original GitHub issuePrerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
PowerShell 7.4.0 Preview 1 Can no longer use robocopy.exe from powershell. As robocopy.exe returns status code other than 0 for successful copies.
Repro:
- robocopy .\PowerShell-7.4.0-preview.1-win-x64\ .\temp\
Expect: Runs without creating an error object.
Actual: Creates Error Object NativeCommandExitException: Program “Robocopy.exe” ended with non-zero exit code: 1.
Issue: This will break all of our existing automation. We use robocopy everywhere. And our scripts all use ErrorAction = Stop
Expected behavior
robocopy .\PowerShell-7.4.0-preview.1-win-x64\ .\temp\
# Files are copied. No error is raised when all files are copied.
Actual behavior
robocopy .\PowerShell-7.4.0-preview.1-win-x64\ .\temp\
# An error is raised even though robocopy detected no errors.
# 1 indicates all files copied.
Error details
PS > Get-Error
Exception :
Type : System.Management.Automation.NativeCommandExitException
Path : C:\Windows\system32\Robocopy.exe
ExitCode : 1
ProcessId : 17460
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Program "Robocopy.exe" ended with non-zero exit code: 1.
HResult : -2146233087
CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : ProgramExitedWithNonZeroCode
Message : Program "Robocopy.exe" ended with non-zero exit code: 1.
HResult : -2146233087
TargetObject : C:\Windows\system32\Robocopy.exe
CategoryInfo : NotSpecified: (C:\Windows\system32\Robocopy.exe:String) [], NativeCommandExitException
FullyQualifiedErrorId : ProgramExitedWithNonZeroCode
Environment data
$PSVersionTable
Name Value
---- -----
PSVersion 7.4.0-preview.1
PSEdition Core
GitCommitId 7.4.0-preview.1
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
Issue Analytics
- State:
- Created 8 months ago
- Reactions:3
- Comments:27 (15 by maintainers)
Top Results From Across the Web
Robocopy command is not copying files and folders
Try Below robocopy "Source" "destination" /MIR /E /XO /xx /tee /R:2 /W:1 /SEC /LOG:"o/p path". MIR - mirrors directory - deletes files which ......
Read more >[SOLVED] Robocopy not working - PowerShell
I am looking for a simple script to move files older than 2 days old, from a Windows 7 on domain workstation, to...
Read more >Robocopy broken in Win 10 v2004?
Is robocopy in Win 10 v2004 totally borked? I have been using a batch file for 5 years now to robocopy my documents,...
Read more >windows 10 - Robocopy not working on Win10 machine
I can't get robocopy to work within a simple batch file (my first), as I keep getting ERROR 123 (0x0000007B) [below]; I've searched...
Read more >Backup and compare with robocopy not working
I've backed up the Windows folder from a Windows 10 boot drive with robocopy F:\Windows E:\roboRubi\Windowsz /mir
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jazzdelightsme I believe it was mentioned in a separate issue that
$PSNativeCommandUseErrorActionPreference
is default to$false
and only set to$true
in 7.4 previews to get feedback.This is indeed far from intuitive…