sbergwall / RobocopyPS

RobocopyPS
MIT License
51 stars 9 forks source link

[Request] Add option to clear `$global:LastExitCode` on success #22

Open skaravos opened 1 year ago

skaravos commented 1 year ago

Hey, I was just wondering if you think it might be a good idea to add a parameter -ClearLastExitCodeOnSuccess that would reset the $global:LastExitCode back to zero when the Robocopy operation "succeeded".

The logic is already implemented in the parser to set the Success property of the returned object, so it wouldn't be a difficult thing to check at the end of the Invoke-Robocopy operation.

I'll start working on a basic implementation of it, you can review the PR and decide whether it's a good idea or not.

sbergwall commented 1 year ago

Hi @skaravos.

Please do and I will take a look :)