你好,我有以下代码
string newDist = destination + "/" + fileName;
var o = new Process
{
StartInfo =
{
FileName = pathToGitClient,
Arguments = $"-c \"eval $(ssh-agent) && ssh-add {privateKey} && git clone {repoUrl} {repoDest}\""
}
};
o.Start();这基本上使用git文件夹中的git-bash.exe创建了一个git克隆进程。如果我想在克隆的同时隐藏命令行窗口,我该怎么做?
我试过了
o.StartInfo.UseShellExecute = false;
o.StartInfo.CreateNoWindow = true;但它并没有起作用
发布于 2017-07-06 22:12:44
您可以使用接受ProcessWindowStyle枚举实例的StartInfo.WindowStyle。
o.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
// or
o.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;您仍然需要将UseShellExecute设置为false才能正常工作。
https://stackoverflow.com/questions/44950396
复制相似问题