Image: Wi-Fi Toggle button in Windows 10

If I try to connect to a wireless network using netsh wlan connect when the Wi-Fi toggle switch is off, the following error is displayed:

Function WlanGetAvailableNetworkList returns error 2150899714:

The wireless local area network interface is powered down and doesn't support the requested operation.

I've tried re-enabling the wireless interface using netsh int set int, but that didn't seem to re-toggle the Wi-Fi button. How do I connect to a wireless network via the command line if the Wi-Fi toggled switch is disabled? I suspect the similar problem occurred with a laptop–that had a corrupted Windows 10 upgrade, which led to explorer.exe not working–when I tried to connect it to the Wi-Fi.

The network interface has already been enabled, so that isn't the problem. It seems separate from the Wi-Fi toggle switch.

  • @Sandeep That seems more about enabling/disabling the interface than actually connecting to Wi-Fi? The interface is already enabled, but netsh wlan connect doesn't work if Wi-Fi toggle switch is off. – WeavingBird1917 Jun 15 at 13:48
  • @WeavingBird1917 It needs to be done in two steps. First you need to enable network adapter and then you can connect to wifi. Here you can find commands to enable/disable network adapter (see answer posted by abzcoding. After enabling wlan adapter try connecting netsh wlan connect. – Sandeep Jun 15 at 14:02
  • @Sandeep I tried the solution as suggested by abzcoding which uses wmic, however that doesn't seem to toggle the Wi-Fi switch. Running netsh wlan connect after also still gives the same error. I don't think the Wi-Fi toggle button enables/disables the interface, as the interface is shown to be "Enabled" (via netsh int show int) even when the Wi-Fi toggle switch is off. – WeavingBird1917 Jun 15 at 14:08
  • So I guess the real question is, is there any way of toggling the Wi-Fi setting on/off in Windows 10 via the command line, so that the netsh commands will work like normal? – WeavingBird1917 Jun 15 at 16:22
up vote 5 down vote accepted

Below is a batch script that will toggle the state of Wi-Fi either ON or OFF to the opposite state it in when it runs. This uses ms-settings:network-wifi to open the Wi-Fi Settings screen, and then it presses the space key one time using sendkeys to toggle. This method builds a dynamic vb script with a batch script and then executes the vb script with cscript to emulate pressing the space key.

GUI Toggle

enter image description here


Note: Just save this to a text file with a .bat or .cmd extension and execute it to run.


explorer ms-settings:network-wifi
ping -n 5 > nul

SET TempVBSFile=%tmp%\~tmpSendKeysTemp.vbs
IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"
ECHO Set WshShell = WScript.CreateObject("WScript.Shell") >>"%TempVBSFile%"
ECHO Wscript.Sleep 500                                    >>"%TempVBSFile%"
ECHO WshShell.SendKeys " "                                >>"%TempVBSFile%"
ECHO Wscript.Sleep 500                                    >>"%TempVBSFile%"

CSCRIPT //nologo "%TempVBSFile%"

Further Resources

  • @WeavingBird1917 You can add NETSH WLAN CONNECT SSID=<SSID> NAME=<WLAN Profile Name> to the bottom of the script (just above the EXIT)—and I'll edit to add as an example if needed once I hear back from you if this method will suffice to turn ON the wi-fi and then connect to it via NETSH afterwards – Pimp Juice IT Jun 16 at 1:05
  • 2
    Very nice answer, but I'm wondering if it would have worked on the crippled Windows 10 install, where a lot of default Windows apps, including explorer.exe was corrupted. Using the command line might be the only option in that case. If there are no other answers in two days, I will definitely accept this one. – WeavingBird1917 Jun 16 at 10:28

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.