您好我如何安装应用程序,例如它存储在C:\ Temp \ Filename \ Filename \ abc.exe中并使用process.start。这是我的代码
Dim wi = WindowsIdentity.GetCurrent()
Dim wp = New WindowsPrincipal(wi)
Dim path = "C:\Temp\Unzip\IDGo800_Minidriver_32.zip\IDGo800_Minidriver_32"
Dim runAsAdmin As Boolean = wp.IsInRole(WindowsBuiltInRole.Administrator)
If Not runAsAdmin Then
' The following properties run the new process as administrator
Dim startInfo As New ProcessStartInfo(Assembly.GetExecutingAssembly().CodeBase)
startInfo.FileName = "C:\Windows\System32\cmd.exe"
startInfo.Arguments = "msiexec /i " & path & "\IDGo800_Minidriver_64.msi"" ALLUSERS=1 /qn /norestart"""
startInfo.WindowStyle = ProcessWindowStyle.Normal
startInfo.UseShellExecute = True
startInfo.Verb = "runas"
Dim myProcess As Process = Nothing
Try
myProcess = Process.Start(startInfo)
Do
If myProcess.HasExited Then
Console.WriteLine("Install complete")
End If
Loop While Not myProcess.WaitForExit(1000)
Catch ex As Exception
MsgBox(ex)
End Try
End If
答案 0 :(得分:0)
已经回答了问题。
startInfo.Arguments = "/c msiexec /i " & path & "\IDGo800_Minidriver_64.msi"" ALLUSERS=1 /qn /norestart"""