user1107078
user1107078

Reputation: 455

"Rights" issue When start program from another program in Windows with .Net Process.Start()

i use a program to see if my application is crashed and in this case i start it again. Let's call this application B while main application it's called A.

The main problem begin when the Application A is started from B.

Seems there are "Rights" problems to execute this code :

var processInfo = new ProcessStartInfo("myfile.bat")
                              {CreateNoWindow = true, UseShellExecute = false};
        processInfo.Verb = "runas";
        var process1 = Process.Start(processInfo);
        process1.WaitForExit();
        process1.Close();

I have this problem on Win Xp and 7. I tried to execute Application B with "Execute as Administrator" too without any result.

It's seems a Rights problem cause if i launch the program without Application B it works without problem.

Upvotes: 0

Views: 91

Answers (1)

Steve
Steve

Reputation: 216293

Try to set UseShellExecute = true.

I don't know if a 'bat' files qualifies as executable.
And the docs says that only executables could be started when UseShellExecute is false.

Upvotes: 2

Related Questions