2012-07-16 71 views
2

我正在嘗試運行該進程並等待其關閉。 當我運行VSIXInstaller喜歡它下面的工作:啓動進程無法與VSIXInstaller.exe配合使用

$pathToTheExtension = $path + "VS2012.Ext.vsix" 
VSIXInstaller.exe $pathToTheExtension 

但是,當我從開始處理運行VSIXInstaller沒有得到$ pathToTheExtension作爲參數。

$pathToTheExtension = $path + "VS2012.Ext.vsix" 
$result = $(Start-Process -filePath "VSIXInstaller.exe" -argumentList $pathToTheExtension -Wait) 

我應該如何通過啓動進程將路徑傳遞給vsix文件?

以下是運行啓動過程的結果。

enter image description here

編輯

我檢查來自Process Explorer中運行VSIXInstaller進程的命令行參數,它對於我來說似乎是正確的。

"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\VSIXInstaller.exe" "C:\VS2012.Ext.vsix" 

回答

4

你需要用引號括住的參數值。

$pathToTheExtension = '"{0}VS2012.Ext.vsix"' -f $path; 
$result = Start-Process -FilePath "VSIXInstaller.exe" -ArgumentList $pathToTheExtension -Wait -PassThru; 
+0

不幸的是,它導致了相同的結果 – k0stya 2012-07-16 21:52:23

+0

$ path是否有尾部斜線?如果不是,則必須在文件路徑和文件名之間添加一個(緊跟在{0}之後)。 – 2012-07-16 22:01:17

+0

$ path是有效的,因爲我能夠使用VSIXInstaller.exe運行它$ pathToTheExtension – k0stya 2012-07-16 22:02:34