Reputation: 1140
I am searching for a way to execute a bash shell script without displaying the terminal window. I start it from a c# program. The property ProcessStartInfo.CreateNoWindow have no effect on suppress opening the bash terminal.
Process process = new Process {
StartInfo = new ProcessStartInfo {
FileName = gitPath + "\\bash.exe",
Arguments = "-c ./script.sh",
WorkingDirectory = Directory.GetCurrentDirectory(),
CreateNoWindow = true} };
I hope the is maybe a parameter in bash?
Upvotes: 1
Views: 1049
Reputation: 1140
WindowStyle = ProcessWindowStyle.Hidden does the trick!
Process process = new Process {
StartInfo = new ProcessStartInfo {
FileName = gitPath + "\\bash.exe",
Arguments = "-c ./script.sh",
WorkingDirectory = Directory.GetCurrentDirectory(),
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden} };
Upvotes: 1