test2
This commit is contained in:
@@ -1572,7 +1572,25 @@ $script
|
|||||||
Invoke-ScriptMonkey @PSBoundParameters
|
Invoke-ScriptMonkey @PSBoundParameters
|
||||||
} else {
|
} else {
|
||||||
# iwr | iex fallback
|
# iwr | iex fallback
|
||||||
|
if ($args.Count -gt 0) {
|
||||||
|
# Convert -Param value -Switch into a hashtable for splatting
|
||||||
|
$namedArgs = @{}
|
||||||
|
for ($i = 0; $i -lt $args.Count; $i++) {
|
||||||
|
if ($args[$i] -is [string] -and $args[$i].StartsWith('-')) {
|
||||||
|
$key = $args[$i].TrimStart('-')
|
||||||
|
$next = $args[$i + 1]
|
||||||
|
if ($next -and ($next -notlike '-*')) {
|
||||||
|
$namedArgs[$key] = $next
|
||||||
|
$i++ # Skip next one, it's the value
|
||||||
|
} else {
|
||||||
|
$namedArgs[$key] = $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Invoke-ScriptMonkey @namedArgs
|
||||||
|
} else {
|
||||||
Invoke-ScriptMonkey
|
Invoke-ScriptMonkey
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user