0

I want to run cmd in a asp.net application. Here is my code:

System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "cmd";
process.StartInfo.Arguments = "cd C:\\";
process.Start();

The program starts the cmd.exe but instead of "C:>" I see this:

C:\program Files\Common Files\Microsoft Shared\Devserver\10.0>

Could somebody tell me what i do wrong in the code? Thanks in advance!

1

1 Answer 1

1

The Arguments are used as the parameters to the application being called, therefore it's the same as having cmd "cd c:\" in your Run prompt under the Start Menu.

In this instance, what I think you want is the following (instead of the Arguments line)...

process.StartInfo.WorkingDirectory = "c:\\";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.