Friday, June 12, 2020

Run Another Program With Administrator Privileges .NET

You can run another application from your application by using :
procExecuting = Process.Start(TPC.exe)

After that you could write a general method that you could use for different .exe files that you want to use. It would be like below.

Sample code :

Dim appPath As String = Application.StartupPath()
Dim procStartInfo As New ProcessStartInfo
Dim procExecuting As New Process

With procStartInfo
    .UseShellExecute = True
    .WorkingDirectory = appPath & "\"
    .FileName = "TPC.exe"
    .WindowStyle = ProcessWindowStyle.Normal
    .Verb = "runas"
End With

procExecuting = Process.Start(procStartInfo)

Run Another Program With Administrator Privileges .NET

Post a Comment