I have the following bit of code
$individualSlidesOutputDir = join-path ([io.path]::GetTempPath()) ([Guid]::NewGuid())
set-alias pdftk 'C:\\Program Files (x86)\\PDF Labs\\PDFtk Server\\bin\\pdftk.exe' -scope script
phantomjs ./slides2pdf.coffee $individualSlidesOutputDir #writes some files to this directory
$args = ls $individualSlidesOutputDir | %{$_.FullName}
pdftk $args[0] $args[1] $args[2] cat output slide-deck.pdf
I need exactly that, but $args might have an arbitrary amount of values using $args -join " " doesn’t work as that seems to be interpreted as all one argument. I’m pretty sure I could do this with start-process but I’m hoping there’s a less cumbersome way.
I would avoid using $args since that is a reserved variable in PowerShell. It would work in this case but in other contexts, you could be blowing away access to useful arguments. That said, you should just be able to invoke like so: