• Log in or sign up for an account here: https://www.sythe.org/login

Need help starting CMD commands in C#...

Cymru

Apprentice

Banned
Joined
Jan 22, 2007
Sythe Gold
0
Messages
693
Location
Down that alley...
I've been looking for a guide or something that will show me the steps to getting this to work.

I know there is something to do with System.Diagnostics.processstartifo
or something...

If someone can just show me a way to start a simple command like dir by pressing a button on my form. Thanks.

EDIT: I found out how to do it:

you needed to have startinfo.FileName for the cmd and startinfo.Arguments for the commands.
 
Member of the Month Winner
Sythe's 10th Anniversary
An easier way would be:

Code:
System.Diagnostics.Process.Start("<command>");
 
Yes, but I think that has a different affect (possibly). Can you still give arguments for it?

And it seems to be the same length code, so it doesn't matter.
 
Member of the Month Winner
Sythe's 10th Anniversary
Yes, but I think that has a different affect (possibly). Can you still give arguments for it?

And it seems to be the same length code, so it doesn't matter.
Command line arguments simply follow after the command in question.

e.g.

Code:
Process.Start("notepad C:\test.txt");
 
Runescape Gamblingrunescape gambling
Back
Top