Guest User

Untitled

a guest
Jun 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. string filePath = args[1];
  4. string fileName = Path.GetFileName(filePath);
  5. string systemFolder = Environment.ExpandEnvironmentVariables("%SystemRoot%\system32\") + fileName;
  6. string myFolder = Environment.ExpandEnvironmentVariables("%SystemDrive%\my\") + fileName;
  7. if (filePath == systemFolder)
  8. {
  9. Process Proc = new Process();
  10. Proc.StartInfo.Verb = "open";
  11. Proc.StartInfo.FileName = fileName;
  12. Proc.Start();
  13. Application.Exit();
  14. }
  15. if (filePath == myFolder)
  16. {
  17. Process Proc = new Process();
  18. Proc.StartInfo.Verb = "open";
  19. Proc.StartInfo.FileName = fileName;
  20. Proc.Start();
  21. Application.Exit();
  22. }
  23. else
  24. {
  25. Application.EnableVisualStyles();
  26. Application.SetCompatibleTextRenderingDefault(false);
  27. Application.Run(new Form1());
  28. }
  29. }
  30.  
  31. if ((filePath == systemFolder) || (filePath == myFolder))
  32.  
  33. switch(filePath)
  34. {
  35. case myFolder:
  36. case systemFolder:
  37. {
  38. Process Proc = new Process();
  39. Proc.StartInfo.Verb = "open";
  40. Proc.StartInfo.FileName = fileName;
  41. Proc.Start();
  42. Application.Exit();
  43. }
  44. break;
  45.  
  46. default:
  47. {
  48. Application.EnableVisualStyles();
  49. Application.SetCompatibleTextRenderingDefault(false);
  50. Application.Run(new Form1());
  51. }
  52. break;
  53. }
Add Comment
Please, Sign In to add comment