The HTML code is as follows, could you tell me how to solve?
If (e.K eyCode==Keys. Enter)
{
//if (CmdProcess==null)
{
CmdProcess=new Process ();//create the process object
CmdProcess. StartInfo. FileName="CMD. Exe";//set to execute commands
//startInfo. The Arguments="/" C + command;///"C" said exit immediately after execution of the command
CmdProcess. StartInfo. UseShellExecute=false;//do not use the system shell start
CmdProcess. StartInfo. RedirectStandardInput=true;//can redirect input
CmdProcess. StartInfo. RedirectStandardOutput=true;
CmdProcess. StartInfo. RedirectStandardError=true;
CmdProcess. StartInfo. CreateNoWindow=false;//do not create window
CmdProcess. Start (); -- -- -- -- -- -- -- -- -- in this step, the screen will pop-up CMD black window, then don't go on, must turn off to continue
}
CmdProcess. StandardInput. AutoFlush=true;
CmdProcess. StandardInput. WriteLine (TextBoxCmdInput. Text);
TextBoxCMDShow. Text +="is \ r \ n" + TextBoxCmdInput. Text;
TextBoxCMDShow. Text +="is \ r \ n" + CmdProcess. StandardOutput. ReadToEnd ();
CmdProcess. StandardInput. WriteLine (" exit ");
If (CmdProcess!=null)
{
CmdProcess. WaitForExit ();
CmdProcess. Close ();
}
//SearchRealization (FuzzySearch: true);
E.H andled=true;
}
}
CodePudding user response:
Process Process=new Process
{
StartInfo=
{
FileName="CMD. Exe",
UseShellExecute=false,//no use shell startup
RedirectStandardInput=true,//CMD accepts standard input
RedirectStandardOutput=false,//don't want to listen to CMD so don't his output
RedirectStandardError=true,//to redirect the standard error output
CreateNoWindow=true,//no display window
}
};
Process. The Start ();
//send the CMD window behind the input information & amp; Exit tell CMD running after exit
Process. The StandardInput. WriteLine ($" start {url} & amp; The exit ");
Process. The StandardInput. AutoFlush=true;
Process. WaitForExit ();//wait for program execution of the exit process
Process. The Close ();
The key is: RedirectStandardOutput=false,//don't want to listen to CMD he output so don't talk
CodePudding user response:
RedirectStandardOutput=false, readtoend behind, there is no back toCmdProcess. StartInfo. WindowStyle=ProcessWindowStyle. Hidden;
CmdProcess. Start ();
CmdProcess. StandardInput. WriteLine (TextBoxCmdInput. Text + "& amp; The exit ");//+ "& amp; The exit "
CmdProcess. StandardInput. AutoFlush=true;
TextBoxCMDShow. Text +="is \ r \ n" + TextBoxCmdInput. Text;
TextBoxCMDShow. Text +="is \ r \ n" + CmdProcess. StandardOutput. ReadToEnd ();
TextBoxCmdInput. Text + "& amp; Exit "with this, you can run, but still have the black window sparkles, this how to solve?
CodePudding user response:
CreateNoWindow=true,//no display windowCodePudding user response:
Thank you, see, this is no shows,$" start {url} & amp; The exit "
This can explain in detail?
TextBoxCmdInput. Text + "& amp; The exit "
I am using this command, you will be inside the window display & amp; The exit, ugly
Don't add, and then crashed,
CodePudding user response:
Why use CMD?CodePudding user response:
Silent mode to performCodePudding user response:
Can the background