I am writing a launcher in C# that processes user input and I would like its corresponding output string to be piped into an external program. The external program is a precompiled C# executable that is end-of-life, so I cannot easily modify it.
I can easily launch the desired program using ExternalProcess, but do not see any means for sending data over. My desired function calls go something like:
string myString = "string to pass over"
Clipboard.SetText(myString);
Process ExternalProcess = new Process();
ExternalProcess.StartInfo.FileName = "Notepad.exe";
ExternalProcess.Start();
// some kind of paste command here...
// ExternalProcess.magicpaste(myString);
ExternalProcess.WaitForExit();
Is there a better way to go about this? I realize the purported security implication in piping text this way, but I need to create a simple launcher program to support a legacy project.