‘Sup PSHomies!
Boe Prox recently blogged about building a enum that supports bitfields in PowerShell, definitely worth the read!
The first thing I thought about was RoboCopy! As you may or may not know, I’m a huge fan (no pun intended) of RoboCopy! I know that RoboCopy returns exitcodes, I just didn’t do anything with it. Instead of relying on the exitcode, I’ve created a Get-LogSummary script to give me an overview of what failed or succeeded. Now that I see how easy it can be, why not give it a try? 😉
I’m running Windows 10 so I went with the PowerShell 5.0 version
So let’s give it a run!
#Start RoboCopy $source = '.\c#' #Choose a source $target = '.\temp' #Choose a target robocopy $source $target /MIR [RoboCopyExitCodes]$LASTEXITCODE
The target isn’t empty. I’m using /MIR to make a point. Be careful when choosing your target!
So the first run gave an exitcode of 3
Nice!
A second run gave an exitcode of 0
No change indeed!
As a first impression, could be useful… So there you have it! RoboCopy exitcodes the *ahem* PowerShell way! 😛
Hope it’s worth something to you
Ttyl,
Urv