相關命令提示符(也可以用BAT腳本方式調用)
- 設置系統自帶的虛擬網卡Microsoft Virtual WiFi Miniport Adapter,從而創建熱點(只需在首次使用前配置):
netsh wlan set hostednetwork mode=allow ssid=Blz_Galaxy key=1234567890
此處熱點標識爲Blz_Galaxy,密碼爲1234567890,請自行修改。
- 開啓分享的Wifi熱點:
netsh wlan start hostednetwork
- 關閉Wifi熱點:
netsh wlan stop hostednetwork
- 定時關機(3600秒後關機):
shutdown -s -t 3600
- 設定關機後也可以取消關機計劃:
shutdown -a
System.Diagnostics.Process _pCmd; _pCmd = new System.Diagnostics.Process(); _pCmd.StartInfo.FileName = "cmd.exe"; _pCmd.StartInfo.UseShellExecute = false; _pCmd.StartInfo.RedirectStandardOutput = true; _pCmd.StartInfo.RedirectStandardInput = true; _pCmd.StartInfo.CreateNoWindow = true; _pCmd.Start(); //執行目標指令 _pCmd.StandardInput.WriteLine("shutdown -a");
<pre name="code" class="csharp">Regex reg = new Regex(@"[\u4e00-\u9fa5]");//正則表達式
if (reg.IsMatch(textBox1.Text) || reg.IsMatch(textBox2.Text))
{
MessageBox.Show("不能含有漢字");
return;
}
if (textBox2.Text.Length < 8)
{
MessageBox.Show("密碼8位以上");
return;
}
_strWrite = String.Format("netsh wlan set hostednetwork mode=allow ssid={0} key={1}", this.textBox1.Text, this.textBox2.Text);
_pCmd.StandardInput.WriteLine(_strWrite);