运行 git bash for windows 静默模式

run git bash for windows in silent mode

我正在寻找一种在不显示终端 window 的情况下执行 bash shell 脚本的方法。我从一个 c# 程序开始。 属性 ProcessStartInfo.CreateNoWindow 对抑制打开 bash 终端没有影响。

Process process = new Process {
                StartInfo = new ProcessStartInfo {
                    FileName         = gitPath + "\bash.exe",
                    Arguments        = "-c ./script.sh",
                    WorkingDirectory = Directory.GetCurrentDirectory(),
                    CreateNoWindow   = true} };

我希望这可能是 bash 中的一个参数?

WindowStyle = ProcessWindowStyle.Hidden 成功了!

Process process = new Process {
                StartInfo = new ProcessStartInfo {
                    FileName         = gitPath + "\bash.exe",
                    Arguments        = "-c ./script.sh",
                    WorkingDirectory = Directory.GetCurrentDirectory(),
                    CreateNoWindow   = true,
                    WindowStyle      = ProcessWindowStyle.Hidden} };