Hello, I'm a newbie and probably doing something wrong.
If I do this in PowerShell:
$childItems = ( Get-ChildItem -Path $somePath -Name -Directory -Include foo*,bar* )
$childItems
Everything works out just fine and the second line prints out a bunch of directories that it found. No problem.
However, if I take the same inclusions and put them into a variable and feed the -Include parameter that variable:
$inclusions = 'foo*,bar*'
$childItems = ( Get-ChildItem -Path $somePath -Name -Directory -Include $inclusions )
$childItems
it no longer works. Then, $childItems ends up having nothing in it.
The weird thing is that if I take out the comma in $inclusions and everything to the right of it, it will work fine for just the one inclusion:
$inclusions = 'foo*'
$childItems = ( Get-ChildItem -Path $somePath -Name -Directory -Include $inclusions )
$childItems
The same happens with the -Exclude parameter, as well.
Would love some help to know what I'm doing wrong. Thanks!