1

I would like to run a batch command in c# code.

I tried this code but it only pops up cmd but I want it to pop up cmd and displays "Hello World".

Process.Start("cmd", "echo Hello World");

Is it possible to do this?

1 Answer 1

5

Try this:

Process.Start("cmd", "/K echo Hello World");

(Note the "/K")

based on this reference for cmd.exe

Sign up to request clarification or add additional context in comments.

1 Comment

Cool website! Thanks for the link.

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.