My Script calls a function that needs the parameters from the calling of the scripts:
function new( $args )
{
if( $args.length -lt 8 )
{
Write-Host "Parameter Missing, requires 8 Parameters. Aborting."!
Write-Host $args.length
break
}
}
switch ($args[0]) {
'--test' { }
'--new' { new $args }
default { }
}
When I call it, the args array is not handed over to the new
function:
PS Q:\mles\etl-i_test> .\iprog.ps1 --new 1 2 3 4 5 6 7
Parameter Missing, requires 8 Parameters. Aborting. !
0
How do I pass an array to a function in powershell? Or specifically, the $args array? Shouldn't the scope for the $args array be global?
param(...)
- stackoverflow.com/a/12425338/763026 – Angshuman Agarwal Apr 5 at 14:46