troubleshooting Question

How to pass the output of DOS command exectued from C# code to the display of page. To tell user about the progress.

Avatar of KenPC
KenPC asked on
Web Languages and StandardsC#ASP.NET
3 Comments1 Solution1927 ViewsLast Modified:
Hi Experts,

I'm doing development. And I'm using C# to execute DOS commands(which the DOS command line execute some test application).

Once the user click the Execute Button(just a regular button, that the event invoke the execution of DOS command) at the page,  the DOS command would be executed.

I would like to pass the output/debug messages or any messages output by the DOS command to the page so that user can see the progress and some information about the DOS command execution.

My DOS command is to call the source control(MKS) application to create a sandbox in my pc. I would like to pass the messages output by this command to the page. (When I execute this DOS  command in DOS prompt it would output the error messages e.g pass, fail to create sandbox, and etc.)

Dumping the output to the label would work. But how to get the output/debug messages of the DOS exectution in C#.?

string mksCreateVariantSandboxCmdStr = @"si createsandbox -R --populate --project=" + getProjectNameStr() + @" --devpath=" + getVariantNameStr() + @" --status=default --yes " + getSandPathStr();
//Working example of executing dos command in C#
        //create & mapping the variant sandbox
        System.Diagnostics.Process processCrVarSandBox = new System.Diagnostics.Process();
        processCrVarSandBox.EnableRaisingEvents = false;
        System.Diagnostics.Process.Start("cmd.exe", @"/C " + mksCreateVariantSandboxCmdStr);
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros