嗨,我如何安装一个应用程序,例如它存储在C:TempFilenameFilenameabc.exe中,并使用process.start。这是我的代码
Dim wi = WindowsIdentity.GetCurrent()
Dim wp = New WindowsPrincipal(wi)
Dim path = "C:TempUnzipIDGo800_Minidriver_32.zipIDGo800_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:WindowsSystem32cmd.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
答案已经出来了
startInfo.Arguments = "/c msiexec /i " & path & "IDGo800_Minidriver_64.msi"" ALLUSERS=1 /qn /norestart"""