Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- string filePath = args[1];
- string fileName = Path.GetFileName(filePath);
- string systemFolder = Environment.ExpandEnvironmentVariables("%SystemRoot%\system32\") + fileName;
- string myFolder = Environment.ExpandEnvironmentVariables("%SystemDrive%\my\") + fileName;
- if (filePath == systemFolder)
- {
- Process Proc = new Process();
- Proc.StartInfo.Verb = "open";
- Proc.StartInfo.FileName = fileName;
- Proc.Start();
- Application.Exit();
- }
- if (filePath == myFolder)
- {
- Process Proc = new Process();
- Proc.StartInfo.Verb = "open";
- Proc.StartInfo.FileName = fileName;
- Proc.Start();
- Application.Exit();
- }
- else
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
- }
- }
- if ((filePath == systemFolder) || (filePath == myFolder))
- switch(filePath)
- {
- case myFolder:
- case systemFolder:
- {
- Process Proc = new Process();
- Proc.StartInfo.Verb = "open";
- Proc.StartInfo.FileName = fileName;
- Proc.Start();
- Application.Exit();
- }
- break;
- default:
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
- }
- break;
- }
Add Comment
Please, Sign In to add comment