Groups | Blog | Home
all groups > c# > november 2003 >

c# : Executing DOS commands.... F1 F1 pls...


Justine
11/30/2003 10:02:13 PM
Hi All,

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


Thanz in Advance,
Justine
11/30/2003 11:02:41 PM
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.

[quoted text, click to view]
Vijaye Raji
11/30/2003 11:50:14 PM
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

[quoted text, click to view]

Arild Bakken
12/1/2003 7:50:02 AM
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

[quoted text, click to view]

Willy Denoyette [MVP]
12/1/2003 11:17:46 PM
take a look at the start command, something like "start /B cmd.exe /C dir"
should do what you are after.

Willy.


[quoted text, click to view]

AddThis Social Bookmark Button