Can't create text file by command line command.

B

Boki Digtal

Hi All,

I want to get MAC address by command line directly.


private void Form1_Load(object sender, EventArgs e)
{
System.Diagnostics.Process Process3;
Process3 = new System.Diagnostics.Process();

String cmd = "ipconfig";

Process3 = System.Diagnostics.Process.Start(cmd, ">
mac_add.txt");

Process3.WaitForExit();
// Process3.Close();
}

but I get nothing when I perform it.

Thank you!

Best regards,
Boki.
 
G

Guest

Boki said:
Hi All,

I want to get MAC address by command line directly.


private void Form1_Load(object sender, EventArgs e)
{
System.Diagnostics.Process Process3;
Process3 = new System.Diagnostics.Process();

String cmd = "ipconfig";

Process3 = System.Diagnostics.Process.Start(cmd, ">
mac_add.txt");

Process3.WaitForExit();
// Process3.Close();
}

but I get nothing when I perform it.

Thank you!

Best regards,
Boki.

You are sending "> mac_add.txt" as a parameter to the program. That does
not redirect the output of the program.

Take a look at the ProcessStartInfo.RedirectStandardOutput property.
 

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