The following works
Remove-Item *.xml, *.thm, *.bbl, *.fff
But this does not
$cleanExtensions = "*.xml, *.thm, *.bbl, *.fff"
Remove-Item $cleanExtensions
How can I let Remove-Item accept a variable list of items to remove?
The following works
Remove-Item *.xml, *.thm, *.bbl, *.fff
But this does not
$cleanExtensions = "*.xml, *.thm, *.bbl, *.fff"
Remove-Item $cleanExtensions
How can I let Remove-Item accept a variable list of items to remove?
On the first option you are passing a list, while in the second one you are passing a string
Use the following notation to make your variable a list instead of a string
$cleanExtensions = "*.xml" , "*.thm", "*.bbl", "*.fff"
Remove-Item $cleanExtensions
[object[]].