C#_实现修改IP地址、设置HDCP自动获取

起进程使用管理员权限启动CMD修改本机IP地址

            using (Process process = new System.Diagnostics.Process())
            {
                try
                {
                    process.StartInfo.FileName = "cmd.exe";
                    process.StartInfo.UseShellExecute = true;  // 使用外壳启动
                    process.StartInfo.Verb = "runas";          // 请求管理员权限
                    process.StartInfo.Arguments = $"/C netsh interface ip set address name=\"{(string)this.cb_adapter.SelectedItem}\" source=static addr={this.textBox_ip.Text} mask={this.textBox_maskCode.Text} gateway={this.textBox_gateway.Text} gwmetric=1 & netsh interface ip set dns 

你可能感兴趣的:(C#,c#,tcp/ip,网络)