Wednesday, May 6, 2015

How to go straight to the IPV4 configuration with a click of a button?

I have this requirement to open the IPV4 configuration of the Ethernet adapter, for which I have written the following code.

private void btnIPInfo_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo stInfo = new System.Diagnostics.ProcessStartInfo();
            stInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; //hide cmd window
            stInfo.FileName = "cmd.exe";
            stInfo.Arguments = " /C ncpa.cpl";
            process.StartInfo = stInfo;
            process.Start();
        }

This takes me to the network connections page, where

1) I click on Etherenet adapter,

2) Select IPV4 configuration and click on properties,

3) I get the window to input the IP information, Ip, subnet, gateway etc.

How can I get straight to  step (3) bypassing 1) & 2) ?

Appreciate any help..

Thanks

No comments:

Post a Comment