How can I run a windows batch file but hide the command window?

前端 未结 10 1866
情深已故
情深已故 2020-11-30 01:40

How can I run a windows batch file but hiding the command window? I dont want cmd.exe to be visible on screen when the file is being executed. Is this possible?

10条回答
  •  鱼传尺愫
    2020-11-30 02:32

    Using C# it's very easy to start a batch command without having a window open. Have a look at the following code example:

            Process process = new Process();
            process.StartInfo.CreateNoWindow = true;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.UseShellExecute = false;
            process.StartInfo.FileName = "doSomeBatch.bat";
            process.Start();
    

提交回复
热议问题