ProcessHelper.cs 603 B

1234567891011121314151617181920212223242526
  1. using System.ComponentModel;
  2. using System.Diagnostics;
  3. namespace PixiEditor.Models.Processes
  4. {
  5. public static class ProcessHelper
  6. {
  7. public static Process RunAsAdmin(string path)
  8. {
  9. Process proc = new Process();
  10. try
  11. {
  12. proc.StartInfo.FileName = path;
  13. proc.StartInfo.Verb = "runas";
  14. proc.StartInfo.UseShellExecute = true;
  15. proc.Start();
  16. }
  17. catch (Win32Exception)
  18. {
  19. throw;
  20. }
  21. return proc;
  22. }
  23. }
  24. }