Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerShell quotes for Start-Process ArgumentList

I'm trying to have the app tablacus explorer open a folder path. This works fine with the following formatting:

$ex = 'S:\Tools\explorer\TE64.exe'
Start-Process $ex -ArgumentList '"Tabs,Close other tabs" "Open,C:\Program Files"'

But I would really like to have the path in a variable ($dir = 'C:\Program Files'), and I can't seem to get the quotes right so it gets interpreted properly.

Thank you for your help.

like image 686
DarkLite1 Avatar asked May 29 '15 08:05

DarkLite1


1 Answers

I found two solutions for this on the MS Blog:

$Args = @"
"Tabs,Close other tabs" "Open,$dir"
"@

start $ex -ArgumentList $Args

or

start $ex -ArgumentList """Tabs,Close other tabs"" ""Open,$dir"""
like image 196
DarkLite1 Avatar answered Nov 16 '22 02:11

DarkLite1