I’m looking for a quick bit of help with a really simple homegrown function. The purpose of the script is unimportant, it works and I shan’t embarrass myself publishing a ‘Fisherprice’ example on a forum such as this!!
The function takes any number of arguments, parameters, and the final two are always file names. The former arguments I wish to pass through ‘as is’ and use as ‘options’ to a cmdlet. E.g.:
$s_options = $args[0..($args.length - 3)] -join ' ' # Concatenate all the args but the last two, separate by a space compare-object $s_options $OBJECT1 $OBJECT2 # This is where is goes wrong, with no 'options' it works fine.
I’ve ‘echoed’ the offending line and it shall correctly contain “-IncludeEqual” or whatever I attempt to pass in but when I execute in the function it throws-up.
I must assume I’m missing a trick here, can anyone explain why the cmdlet refuses to ‘see’ the $s_options string as proper options?