Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static ProcessStartInfo ParseCommandLine(string command)
- {
- string[] segments = command.Split(new[] { '"' }, StringSplitOptions.RemoveEmptyEntries);
- string filename = "";
- string args = "";
- if (segments.Length == 1)
- {
- filename = segments[0];
- }
- else if (segments.Length == 2)
- {
- filename = segments[0];
- args = segments[1];
- }
- return new ProcessStartInfo(filename.Trim(), args.Trim());
- }
- var test = ParseCommandLine("C:/my/long/path/executable.exe \"omg\"");
- //test.fileName == "C:/my/long/path/executable.exe"
- //test.Arguments == "omg"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement