Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("Microsoft(R) Windows(R) Command Prompt"); Console.ForegroundColor = ConsoleColor.White; Console.Write("@bash!~cmd: "); string cmdimput = Console.ReadLine(); Process cmd = new Process(); cmd.StartInfo.FileName = "cmd.exe"; cmd.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; cmd.StartInfo.Arguments = cmdimput; cmd.StartInfo.RedirectStandardError = true; cmd.StartInfo.RedirectStandardInput = true; cmd.StartInfo.RedirectStandardOutput = true; cmd.StartInfo.UseShellExecute = false; cmd.StartInfo.ErrorDialog = false; cmd.Start(); StreamWriter inputWriter = cmd.StandardInput; StreamReader outputReader = cmd.StandardOutput; StreamReader errorReader = cmd.StandardError; cmd.WaitForExit(); Console.WriteLine(cmd.StandardOutput.ReadToEnd()); Console.ReadLine();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)