Executing DOS commands.... F1 F1 pls...

J

Justine

Hi All,

How can v execute DOS command while executing Console
Application written using C#, like cls,dir commnads.


Thanz in Advance,
Justine
 
A

Arild Bakken

Use the Process.Start() method with cmd.exe as the command and /C "command"
as the parameters. This will start a new process, and possible a new console
window, I'm not sure if the command will inherit the current console, so you
may have to write your own code to do this.

Arild
 
J

Justine

Hi Arild,

I don't want to start another process as such. Just like
System () Function in C++ which can execute the DOS
command. i would like to have the command executed for as
part of the running console application.
 
V

Vijaye Raji

That, I'm afraid is not possible... You'd need to create a Process "cmd.exe"
and execute all your DOS commands thru it.

vJ
 
W

Willy Denoyette [MVP]

take a look at the start command, something like "start /B cmd.exe /C dir"
should do what you are after.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top