Click here to Skip to main content
15,885,954 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
I am currently working with a Windows From application that will run some commands in command prompt when buttons are clicked.
I am successful to write a code that will open the command prompt when a button is clicked and run multiple commands one-by-one.
Now i want to integrate this command prompt in my windows form instead of an external command prompt window.

C#
if (txtPath.Text.ToString() != "")
{
        string cmd1 = string.Format(@"/k pushd " + txtPath.Text.ToString());
        string cmd2 = string.Format("batch1.exe");
        ProcessStartInfo cmdsi = new ProcessStartInfo("cmd.exe");
        cmdsi.Arguments = cmd1 + "&" + cmd2;
        Process.Start(cmdsi);
}


Please help me how i can implement this feature...
Posted

1 solution

Hope that this article will guide you Embedding a Console in a C# Application[^]
 
Share this answer
 
Comments
Member 3776145 23-Feb-15 4:45am    
Hello Sujith,
Thanks for your reply. I have tried that solution but stuck in one point.
I am able to run the commands by clicking the button once and if i try to run the same commands again that time it shows the following error:

"BackgroundWorker is currently busy and cannot run multiple tasks concurrently"

I have used the source code from that link and built in my machine. Then used the .dll file in my project.

have you worked with that code? if yes then kindly help me to make the control working properly for me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900