/C
cmd.exe
async Task ExecuteCommand(string command, string workingDirectory){ try { var processStartInfo = new ProcessStartInfo { FileName = shell, Arguments = commandPrefix + command + commandSuffix, WorkingDirectory = workingDirectory, RedirectStandardOutput = true, RedirectStandardInput = true, RedirectStandardError = true, UseShellExecute = false, CreateNoWindow = true }; using var process = new Process(); process.StartInfo = processStartInfo; process.Start(); var outputTask = OutputToConsole(process.StandardOutput, process); var errorTask = OutputToConsole(process.StandardError, process); var inputTask = InputToProcess(process); await process.WaitForExitAsync(); await Task.WhenAll(outputTask, errorTask, inputTask); } catch (Exception e) { Console.WriteLine($"ErrorN: {e}"); }}