Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help #63

Open
seghier opened this issue May 2, 2024 · 0 comments
Open

Need help #63

seghier opened this issue May 2, 2024 · 0 comments

Comments

@seghier
Copy link

seghier commented May 2, 2024

Hello
How to use it properly in windows form?
i want set the command in textbox, click a run button and get everything happen in external cmd window

private void btnExecute_Click(object sender, EventArgs e)
{
    string command = textBox1.Text;

    ProcessStartInfo psi = new ProcessStartInfo();
    psi.FileName = "cmd.exe";
    psi.RedirectStandardInput = true;
    psi.RedirectStandardOutput = true;
    psi.RedirectStandardError = true;
    psi.UseShellExecute = false;
    psi.StandardOutputEncoding = Encoding.Default;

    consoleControl1.StartProcess(psi);
    consoleControl1.OnConsoleOutput += (s, args) =>
    {
        consoleControl1.WriteOutput(args.Content, Color.White);
    };
}

private void btnQuit_Click(object sender, EventArgs e)
{
    consoleControl1.StopProcess();
}

private void cleanoutput_Click(object sender, EventArgs e)
{
    consoleControl1.ClearOutput();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant