powershell - How to declare an array of strings (on multiple lines) -


why $dlls.count return single element? try declare array of strings such:

$basepath = split-path $myinvocation.mycommand.path  $dlls = @(     $basepath + "\bin\debug\dll1.dll",     $basepath + "\bin\debug\dll2.dll",     $basepath + "\bin\debug\dll3.dll" ) 

you should use like:

$dlls = @(     ($basepath + "\bin\debug\dll1.dll"),     ($basepath + "\bin\debug\dll2.dll"),     ($basepath + "\bin\debug\dll3.dll") )  or  $dlls = @(     $($basepath + "\bin\debug\dll1.dll"),     $($basepath + "\bin\debug\dll2.dll"),     $($basepath + "\bin\debug\dll3.dll") ) 

as answer shows, semicolons work because marks end of statement...that evaluated, similar using parenthesis.

alternatively, use pattern like:

$dlls = @() $dlls += "...." 

but might want use arraylist , gain performance benefits...

see powershell array initialization


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -