Beej126 / SingleInstanceAccumulator

Useful for multi-file shell context menu actions
10 stars 2 forks source link

I am going crazy trying to figure out the correct syntax to pass an array into PowerShell #3

Closed futuremotiondev closed 2 years ago

futuremotiondev commented 2 years ago

C:\Tools\scripts\SingleInstanceAccumulator.exe "-c:powershell -noexit -file C:\Tools\scripts\AddSelectionToFolder.ps1 $files" "%1"

This gives me a comma separated list of all selected files, but in PowerShell it formats it as an array with one key: powershell_8m6xKNVwb3

I've tried every kind of combination of quotes and escape characters, I also tried using the -command parameter instead of -file. I also have no idea what the '-list' parameter is even doing. If I keep it, it gets included as an array element in PS which is obviously not what I want. I know that I could create an array by splitting via comma, but that's no fun :)

Is there any way to push an array into PowerShell properly with this executable?

Thanks so much for your time.

Beej126 commented 2 years ago

@cultmethod i've took a pass at clarifying & frankly correcting several things in the readme ... rather than elaborating here, go re-digest that and see if gets you on track... the last powershell example at the bottom is what you'll want to focus on for passing the files into a ps1 as an array

also, make sure to read the new General tips

to answer your question about "-list" - that was definitely pretty poorly represented in my examples and hopefully is clear now... funny thing, powershell will match "-parmname" with ps1 input parameters on a name starts with basis... it doesn't have to be an exact match, so -list will match $listFileName or $listSomethingElse or $list ... and i was just sortof getting lucky with that mismatch in the quick tests that i had previously pasted into the readme as examples