Sending C# console output to another profile/tab with cmd.exe #18146
-
Within a C# console application, being executed within Windows Terminal, I'm trying to have it create/spawn a new cmd.exe within Windows Terminal, and redirect some output to it, but it's not working. Sample C# code: ProcessStartInfo psi = new() {
FileName = "wt.exe",
Arguments = "--window 0 new-tab cmd.exe /k",
RedirectStandardError = true,
RedirectStandardInput = true,
RedirectStandardOutput = true,
UseShellExecute = false
};
using Process process = Process.Start(psi)!;
using StreamReader reader = process!.StandardOutput;
using StreamWriter writer = process!.StandardInput;
writer.WriteLine("Hello from new console"); Is this something possible with Windows Terminal? Any input would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Sorry, just so I understand - you're trying to launch the Command Prompt (which will produce its own output) and then also write more unrelated output to the same window that is hosting it which will conflict with the output that CMD produces? |
Beta Was this translation helpful? Give feedback.
-
Initial cmd.exe where I run the console app from: New cmd.exe opened which I want to redirect output to: Is it possible to redirect output from one console to the other in Windows Terminal? |
Beta Was this translation helpful? Give feedback.
-
I found a solution using Memory-mapped files. I just have to create two console applications. |
Beta Was this translation helpful? Give feedback.
I found a solution using Memory-mapped files. I just have to create two console applications.