2015-10-15 88 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