Easily execute executables (*.exe), check the exit code, and handle output to stderr
- Defaults to redirecting stderr to stdout (so order is maintained)
- Throws if exit code is non-zero (can specify -AllowableExitCodes)
- Always waits for the command to finish before returning (powershell doesn't unless you explicity capture the output)
Many executables (*.exe) output to stderr, not as a way to indicate an error, but as a way of making it possible to separate streams of output. Powershell on the other hand, thinks anything output to stderr is in fact an error and creates and ErrorRecord from the output. This ErrorRecord shows up in red, and will terminate if $ErrorActionPreference is 'Stop'. This module attempts to alleviate the pain of interacting with executables in Powershell.
Install-Module
requires the NuGet PackageProvider 2.8.5.201 or higher
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
To install the module:
Install-Module Executable
Once the module is installed, you must also import it:
Import-Module Executable
Example:
Invoke-Executable "git pull"
or with the exec
alias:
exec "robocopy C:\source C:\destination" --AllowableExitCodes 0,1,3
For more options: Invoke-Executable
There are many ways to contribute:
- Open a new bug report, feature request or just ask a question by opening a new issue here.
- Participate in the discussions of issues, pull requests and verify/test fixes or new features.
- Submit your own fixes or features as a pull request but please discuss it beforehand in an issue if the change is substantial.
- Submit test cases.