ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "cmd.exe";
psi.Arguments = @"/C cd C:\Program Files\MongoDB\Server\4.2\bin & dir & pause";
using (Process p = Process.Start(psi))
{
p.WaitForExit();
}
With this code, I first open cmd and then run mongo.exe. But after switching to mongo shell, I can't send any commands (with Code). My goal is to automate Mongo ReplicaSet. For this, I need to get input and output by interfering with mongoshell. Thank you in advance for your help.