Hi there.
fcx64 wrote: ↑28.09.2023, 12:00
How do I get an array to my PowerShell script? I tried a lot and this command line is the closest I get. It works for 1 selected item.
Multiple Items don't work.
I know that PowerShell wants an array as
@() but this didn't work either.
Your problem actually has nothing to do with FreeCommander. Windows has the restriction that all programs are executed as the CMD would call them.
You cannot pass an array as a single argument, otherwise it would always be interpreted as a single contiguous string. One possibility would be to split this string inside the script.
The better solution would be to use the advanced parameter "
ValueFromRemainingArguments".
Code: Select all
Param (
[Parameter(Mandatory, ValueFromRemainingArguments)]
[System.String[]] $Babbel
)
foreach ($b in $Babbel) {
Write-Host "$b`n"
}
See
about_Functions_Advanced_Parameters
For example, if you use
%ActivSel% in FreeCommander, you can select multiple files and run the script
Regards, Thomas