Created
June 11, 2020 21:33
-
-
Save 7cc/bf7302fccd592d2c90408b21e5c5021d to your computer and use it in GitHub Desktop.
ScriptBlock_InvokeWithContext.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$s = { param($a) $a+$b } | |
# success | |
$s.InvokeWithContext( | |
$null, | |
[psvariable[]]@([psvariable]::new("b", 3)), | |
2 | |
) # 5 | |
# fail | |
& $s -a 1 -b 2 # 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment