0

i have some troubles with my application. It's a winForm app which has a this code :

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

Now cause a bug in third party dll i need a watchdog to restart program when it crashes.

Now if i start the program manually i havent any problem but when the watchdog start my program it wont start myfile.bat.

It happen on Win7 And WinXp. I tried to disable UAC in Win7 but nothing.

I Used admin hidden account in xp and win7 too, but nothing. How could i fix this problem?

user1107078
  • 455
  • 1
  • 7
  • 18

1 Answers1

0

How do I use ProcessStartInfo to run a batch file? suggests to use UseShellExecute = true, or else spawn cmd.exe with the batch file as a parameter.

Community
  • 1
  • 1
Craig A
  • 1,368
  • 12
  • 11
  • already done. But it's not a bat problem. It a "right" problem i think with Windows. I mean the program is started from the another Program instead by me. – user1107078 Mar 29 '12 at 23:02