eqiz
eqiz

Reputation: 1591

Run program as administrator both Windows 7 and Windows XP

Now i know you can do the following code to get it to run as administrator in Windows 7..

 Dim myProcess2 As New System.Diagnostics.Process()
            Dim startInfo2 As New ProcessStartInfo
            startInfo2.FileName = Application.StartupPath & "\installs\Assistant\RegisterSureFire.exe"
            startInfo2.Verb = "runas"
            myProcess2.StartInfo = startInfo2
            Application.DoEvents()
            myProcess2.Start()

But when you do this in windows XP, that box comes up asking if u want to run it in current user or in admin. Then usually my customer gets confused and gives us a call and blah blah... Is there a way i can make it detect the windows version and if its Below windows Vista then don't use the "runas"?

Or any other helpful methods would be great also!

Upvotes: 0

Views: 719

Answers (1)

SLaks
SLaks

Reputation: 888233

You're looking for the Environment.OSVersion property.

Upvotes: 1

Related Questions