简体   繁体   English

是否有命令或API可以在Windows上打开/关闭wifi功能?

[英]Is there a command or api can turn on/off wifi function on windows?

For the project requirement, I need to find a way to turn on/off wifi function on Windows8 without mouse click. 对于项目需求,我需要找到一种无需单击鼠标即可在Windows8上打开/关闭wifi功能的方法。 I search solution over Internet for a while, I only found the way to access Radio state Does anyone who familiar with windows can give me direction? 我在Internet上搜索解决方案一段时间后,才发现访问无线电状态的方法。熟悉Windows的人可以给我指示吗? Thanks! 谢谢!

您可以使用IRadioInterface界面中的SetRadioState方法来切换Wi-Fi无线电状态。

How about cmd functions? cmd函数如何?

1) turn off wifi 1)关闭wifi

netsh interface set interface name="Wi-Fi" admin=disabled netsh接口设置接口名称=“ Wi-Fi” admin =禁用

2) turn on wifi 2)开启wifi

netsh interface set interface name="Wi-Fi" admin=enabled netsh接口设置接口名称=“ Wi-Fi” admin =启用

3) connect some AP (%1 is the name of the ssid) 3)连接一些AP(%1是ssid的名称)

netsh wlan connect name=%1 ssid=%1 interface="Wi-Fi" netsh wlan连接名称=%1 ssid =%1 interface =“ Wi-Fi”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM