How to run automatically a command in the CMD after starting it as a process (using C#)

35 views Asked by At

I'm trying to develop a ping tester program, and I'd love to add the chance to ping an IP adress by using the CMD, but the user should not write the command, as it should just start by itself and do the ping and display the usual information.

By far this is my code:

process.StartInfo.FileName = "cmd.exe";

process.StartInfo.Arguments = "ping " + element.Ip;   //not working

process.Start();

process.WaitForExit();

If anyone can help me I would be really grateful .

0

There are 0 answers