我尝试使用visual c#中的以下代码进行无线ad-hoc。但它需要两次管理员批准。我该怎么解决?
感谢。
private void button5_Click(object sender, MouseEventArgs e)
{
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "netsh.exe";
startInfo.Arguments = "wlan set hostednetwork mode=allow ssid=" + box1 + " key=" + box2;
startInfo.Verb = "runas";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo = startInfo;
process.Start();
startInfo.FileName = "netsh.exe";
startInfo.Arguments = "wlan start hostednetwork";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo = startInfo;
process.Start();
}