You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// late reply (oops).
The window briefly opening is a side effect of the way the cmd is written; it is designed to execute commands using cmd.exe (or another shell), not directly.
Substantial changes would have to be made to bring this functionality to cmd & I believe it's out of the scope too.
This strays from the simplicity this library offers, however the following snippet has the functionality desired.
// Launches ipconfig, captures the output, & reports its line count.conststringprocessName="ipconfig.exe";varprocess=newProcess{StartInfo=newProcessStartInfo{FileName=processName,RedirectStandardOutput=true,RedirectStandardError=true}};process.Start();constinttimeOut=5000;if(!process.WaitForExit(timeOut)){Console.WriteLine($"{processName} did not finish within the allotted time: {timeOut}ms.");return;}stringoutput=process.StandardOutput.ReadToEnd();intoutputLines=output.Split(Environment.NewLine).Length;Console.WriteLine($"{processName} had {outputLines} lines of output.");
When I run command, the main cmd opened and close fastly.
How to hide it?
The text was updated successfully, but these errors were encountered: