I wanted to run CMD commands using C#. Therefore I copied some Code:
using System.IO;
using System.Diagnostics;
namespace Test
{
internal class Program
{
static void Main(string[] args)
{
Process p = new Process();
ProcessStartInfo info = new ProcessStartInfo();
info.FileName = "cmd.exe";
info.RedirectStandardInput = true;
info.UseShellExecute = false;
p.StartInfo = info;
p.Start();
using (StreamWriter sw = p.StandardInput)
{
if (sw.BaseStream.CanWrite)
{
sw.WriteLine("@echo off");
sw.WriteLine("title Test");
}
}
}
}
}
So. After I run some code like changing color etc, I want to enter normal cmd commands myself but the Window instantly closes. Thanks for any Help :D