user2442074
user2442074

Reputation:

How to open an application

I wrote this code to open my application - the name of the executable is C# code analyser.exe. When I start it under Windows 7 (I don't know how this behaves under different versions of Windows), it displays the following message.

Do you want to allow to following program to make changes to this computer?

So I want Windows to not display it to me! What must I do to prevent this message from displaing?

System.Diagnostics.Process Process = new System.Diagnostics.Process();
Process.StartInfo.FileName = (System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "C# code analyser.exe"));
Process.StartInfo.WorkingDirectory = (System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "C# code analyser.exe"));
Process.Start();

Upvotes: 1

Views: 131

Answers (2)

Manoj
Manoj

Reputation: 883

Use this instead of your code

System.Diagnostics.Process oProcess = new System.Diagnostics.Process();
oProcess.StartInfo.FileName = "HelloWorld.exe";
oProcess.Start();

or you can pass administrator username & password this way

Process.Start(path + "HelloWorld.exe", uname, password, domain);

Upvotes: 2

Menelaos Vergis
Menelaos Vergis

Reputation: 3935

This analyzer project, most probably, have a manifest that request administration mode to run. This means that it will keep raising UAC if the starter process(your app) is not elevated.

You can try run you application as an administrator (right click-run as admin) and then the analyzer will inherit the elevation and it will not raise the UAC message.

Upvotes: 0

Related Questions