Results for “Commands & execution context”
Small, practical examples. Search by task or narrow things down below.
Capture a command’s success-stream output
PowerShell: Assignment collects output values without requiring text redirection to a file.
PowerShell✓ Tested
Check an external process exit status explicitly
PowerShell: LASTEXITCODE reports a native child exit code independently of ordinary PowerShell cmdlet errors.
PowerShell✓ Tested
Check whether a command can be resolved
PowerShell: Get-Command with a local error override supports an expected missing-command lookup.
PowerShell✓ Tested
Discard incidental output from a setup command
PowerShell: Out-Null prevents setup objects from becoming part of a function or script’s useful result.
PowerShell✓ Tested
Inspect a URI through typed properties
PowerShell: The Uri class separates URL components without manual string splitting.
PowerShell✓ Tested
Pass an environment value to a child process
PowerShell: The process environment is inherited by a launched child PowerShell process.
PowerShell✓ Tested
Read named fields from a successful regex match
PowerShell: The Matches table is updated after a successful scalar match operation.
PowerShell✓ Tested
Read the kind of command being invoked
PowerShell: CommandType distinguishes cmdlets from functions, aliases, and external applications.
PowerShell✓ Tested
Restore an environment value after temporary use
PowerShell: Use finally so temporary process configuration does not leak to subsequent work; remove the entry when it was originally absent.
PowerShell✓ Tested
Restore the working location after an operation
PowerShell: Push-Location and Pop-Location manage a directory stack; finally ensures restoration.
PowerShell✓ Tested
Bound a command execution time
Linux Commands: Use timeout and handle status 124 as an expected time limit.
Linux Commands✓ Tested
Add context to a parsing failure
Add context to a parsing failure in a complete Rust program using the standard library.
Rust✓ Tested