新学c#想做一个输入帐号密码开启虚拟wifi的小程序,想调用cmd实现功能,cmd里面直接%变量%就好了,可是在c#语句怎么改才能实现参数调用啊?搜索好久未果,向各大神求助。
public void AA()
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
//向cmd窗口发送输入信息
p.StandardInput.WriteLine("/cnetsh wlan set hostednetwork mode=allow ssid=" + textBox1.Text + " key= " + textBox2.Text);
p.StandardInput.AutoFlush = true;
p.StandardInput.WriteLine("exit");
p.WaitForExit();
p.Close();
}
}
}