2015-10-15 107 views
0

我需要能夠在不同的機器上運行安裝程序,這基本上是爲了最小化用戶輸入,例如,我有7臺不同的計算機通過專用網絡連接,但機器1是一臺那個駐留主數據庫和其他軟件,我需要從機器1運行一個軟件更新到所有機器上。遠程運行安裝程序

Dim p As New Process 
    p.StartInfo.FileName = "\\SHOP" & box & TextBox1.Text & "\E\VastUpdate\AutoITUpdater.exe" 
    p.StartInfo.Arguments = "/i AutoITUpdater.exe" 
    p.Start() 
+0

值去掉-c「請幫助。」 –

回答

0

使用PsExec

下面是一個例子代碼:

Dim application As String = "\\SHOP" & box & TextBox1.Text & "\E\VastUpdate\AutoITUpdater.exe" 
Dim arguments As String = "/i AutoITUpdater.exe" 
Dim location_of_psexec As String = "c:\pstools\psexec.exe" 
Dim remote_machine As String = "remote_machine" 

Dim process As Process = New Process() 
process.StartInfo.UseShellExecute = False 
process.StartInfo.CreateNoWindow = True 
process.StartInfo.FileName = location_of_psexec 
process.StartInfo.Arguments = String.Format("\\{0} -c ""{1}"" ""{2}""", remote_machine, application, arguments) 

process.Start() 

我假定在我的代碼,所述應用程序的路徑(例如"\\SHOP" & box & TextBox1.Text & "\E\VastUpdate\AutoITUpdater.exe")是相對於你的機器,而不是在遠程機器。

如果你想使用相對到遠程機器的路徑,簡單地從取出的process.StartInfo.Arguments