Documentation
README
PowerShell Safe Invocation
Shell
Use PowerShell 7 through pwsh.exe unless Windows PowerShell 5.1 is explicitly required.
When the active shell is uncertain, verify:
$PSVersionTable.PSVersion
$PSNativeCommandArgumentPassing
Do not assume installing PowerShell 7 makes powershell.exe use PowerShell 7:
pwsh.exe= PowerShell 7powershell.exe= Windows PowerShell 5.1
Native Programs
Never construct one large command string when arguments can be passed separately.
Use:
$exe = 'C:\Path With Spaces\tool.exe'
$argList = @(
'--input'
'C:\Data Folder\input.json'
'--flag'
)
& $exe @argList
$exitCode = $LASTEXITCODE
if ($exitCode -ne 0) {
throw "$exe failed with exit code $exitCode"
}
Rules:
This is the opening of the README. Read the full README on GitHub.