Reputation: 421
How is it possible to dynamically load all files in folder and pass them as argument to program?
Now I have to do
coffee --bare --join app.js -c utils.coffee app.coffee forum.coffee items.coffee models.coffee activate.coffee chat.coffee
while, all .coffee files should be loaded automatically, so when I add new file I don't have to edit my script.
Thanks
Upvotes: 2
Views: 1341
Reputation: 29450
You can execute your command like this:
&coffee --bare --join app.js -c $(gci *.coffee)
Upvotes: 2
Reputation: 4619
$arguments = [string]::join(" ",(get-item *.coffee | foreach { $_.Name }))
Invoke-Expression (".\program.exe {0}" -f ($arguments))
Upvotes: 3
Reputation: 25505
You can all all of the files to a string using the following
get-childitem *.coffee | Join-String -Separator " "
Then use start-process to invoke the command
If you dont have the powershell community extension you can use
[string]::join(" ",(gci))
Upvotes: 0