Tag:scripting
All the articles with the tag "scripting".
Execution of external commands (native applications) in PowerShell done right - Part 3
Fixing Invoke-NativeApplication to handle Windows exit codes beyond 0-255 using an IgnoreExitCode switch.
Read more…Execution of external commands (native applications) in PowerShell done right - Part 2
Improved Invoke-NativeApplication with an IsError property on each output line and a prompt function edge-case fix.
Read more…Execution of external commands in PowerShell done right
A PowerShell exec helper that correctly captures stdout and stderr from native commands and checks exit codes.
Read more…PowerShell and IDisposable
Implementing a PSUsing helper function in PowerShell that mimics C# using blocks for IDisposable objects.
Read more…PowerShell auto variable $LastResult
Adding a $LastResult automatic variable to PowerShell by wrapping Out-Default to store the last pipeline output.
Read more…PowerShell Start-Job WTF
Troubleshoots Start-Job scope issues with PSScriptRoot and shows how to invoke a script path asynchronously using ScriptBlock.Create.
Read more…PowerShell scripts and "Pattern Main"
Pattern for structuring PowerShell scripts with a Main function so core logic appears at the top before helper functions.
Read more…Set-StrictMode and legacy code issues
How Set-StrictMode interacts with legacy PowerShell scripts and safe workarounds for missing variables and properties.
Read more…git checkout on bare repo
How to extract files and folders from a bare git repository using git archive, avoiding encoding and binary issues.
Read more…Interesting git helpers snippets
PowerShell git helper snippets: get current branch, resolve refs, test fast-forward, find commit's originating branch.
Read more…