2 ms·
Having to handle exe's and bats separately is _exactly_ the problem with $ErrorActionPreference, and why it's not suitable. I wasn't aware of $PSNativeCommandU
by maccard 4y ago
Having to handle exe's and bats separately is _exactly_ the problem with $ErrorActionPreference, and why it's not suitable.
I wasn't aware of $PSNativeCommandUseErrorActionPreference though, seems like it's very new. How does that work with the helpful windows tools that decide to not return 0 on success (hello, robocopy)
- WorldMaker 4y agoThe answer to that, including robocopy as the direct example used, is at the bottom of that documentation I linked on $PSNativeCommandUseErrorActionPreference: you set it to $false before calling something like robocopy and then reset it when done.