2017-09-10 105 views
0

如何更改路由器IP地址,选择该选项并用按钮保存之后。
想做一个小程序,我可以快速方便地更改路由器的IP地址。wpf - 如何更改IP地址?

namespace WpfApplication1 
{ 
    public partial class MainWindow : Window 
    { 
     public MainWindow() 
     { 
      InitializeComponent(); 
     } 

     private void radioButton_Checked(object sender, RoutedEventArgs e) 
     { 

     } 

     private void button_Click(object sender, RoutedEventArgs e) 
     { 
      if (checkbox1.IsChecked == true) 
      { 
       netsh interface ip set address "Ethernet" static 192.168.1.8 255.255.255.0 192.168.1.1 1 
      } else if (checkbox2.IsChecked == true) 
      { 
       netsh interface ip set address "Ethernet" static 192.168.1.8 255.255.255.0 192.168.1.3 1 
      } else 
      { 

      } 
     } 
    } 
} 
+0

已经回答好几次了,以她为例[link](https://stackoverflow.com/questions/1469764/run-command-prompt-commands) –

回答

1

因此,开始一个处理经由代码可以使用

System.Diagnostics.Process.Start()

例如: System.Diagnostics.Process.Start("ipconfig", @"/all");

的命令将被执行,并且在命令行会关闭了,但我承认我不知道,如何让命令获胜道琼斯保持开放。