Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- if (args.Length == 0)
- {
- // Now start another instance and read from it
- ProcessStartInfo info = new ProcessStartInfo();
- // Set some important properties
- info.RedirectStandardOutput = true;
- info.UseShellExecute = false;
- info.FileName = System.AppDomain.CurrentDomain.FriendlyName;
- // Random arguments string
- info.Arguments = "some arguments to differentiate the 2 usages";
- // Start the process, wait to end, read from it
- Process process = Process.Start(info);
- process.WaitForExit();
- Console.WriteLine(process.StandardOutput.ReadToEnd());
- }
- else
- {
- // If the process was started with arguments, then run the part that we wish to read from
- Console.WriteLine("I wrote something here what you can read there");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement