1

This is what I ve been doing:

Process cmd = new Process();
cmd.StartInfo.FileName = @"cmd.exe";
cmd.StartInfo.Arguments=@"/K cd/";
cmd.StartInfo.Arguments=@"/K cd C:\Users\HP\Documents\NooJApp\_App";
cmd.Start();
cmd.WaitForExit();

But it seems that the second argument is not working, because cmd is not responding to it, it only responds to the first argument. So can anyone help me with that. Thanks

2
  • What is the name of the executable you are running? cmd.exe is the shell which requires an executable. You can only have one string of Arguements so the 2nd one is the only one that is used. "cd" isn't a valid input to the shell cmd. Commented Jul 9, 2017 at 23:55
  • What should the cmd /K ... command line be you want to execute? Commented Jul 10, 2017 at 6:08

1 Answer 1

1

.Arguments only takes one string. You can concatenate strings together to make one string, and you have to escape certain things as described in this MSDN page.

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.