How to turn on/off Airplane Mode(Windows 10) thro' Batch file or Command Prompt?

11,240
  • #1 option

Just use your command line or / file and disable your Wi-Fi adapter:

%__APPDIR__%wbem\wmic.exe path win32_networkadapter where NetConnectionID="Wi-fI" call disable

To enable:

%__APPDIR__%wbem\wmic.exe path win32_networkadapter where NetConnectionID="Wi-fI" call enable

Obs.: This command line needs administrator rights

Read more


  • #2 option

enter image description here

You can also use a hybrid file with the code , which will call the airplane interface mode and disable it by sending the [space] key:

0<!-- : 
@cls & @echo off && mode 50,03 && title <nul && title .\%~nx0 && explorer.exe ms-settings:network-airplanemode
%__APPDIR__%wScript.exe "%~dpnx0?.wsf" && 2>nul >nul %__APPDIR__%taskkill.exe /FI "WindowTitle eq settings*"
goto :EOF & rem :: --> <job> <script language = "vbscript">
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.AppActivate "settings"
WScript.Sleep 333
objShell.SendKeys " "
WScript.Sleep 333 </script></job>
  • Or, compacted code...
0<!-- : &@cls & @echo off && mode 50,03 && title <nul && title .\%~nx0 && explorer.exe ms-settings:network-airplanemode
%__APPDIR__%wScript.exe "%~dpnx0?.wsf" && 2>nul >nul %__APPDIR__%taskkill.exe /FI "WindowTitle eq settings*"
goto :EOF & rem :: --> <job> <script language = "vbscript"> Set objShell = WScript.CreateObject("WScript.Shell")
objShell.AppActivate "settings": WScript.Sleep 500: objShell.SendKeys " ": WScript.Sleep 777: </script></job>

Obs.: For close/kill windows/interface, you need edit the correct name of windows title, in pt-BR work with configur*, I suppose in English maybe setting*:

2>nul >nul %__APPDIR__%taskkill.exe /FI "WindowTitle eq settings*"
2>nul >nul %__APPDIR__%taskkill.exe /FI "WindowTitle eq settings*"
Share:
11,240

Related videos on Youtube

Vicky Dev
Author by

Vicky Dev

B.E. COMPUTER ENGG. WEB DEVELOPER (PHP/Magento/Wordpress/jQuery/Core Javascript/PrototypeJs/)

Updated on September 18, 2022

Comments

  • Vicky Dev
    Vicky Dev over 1 year

    After going thro' all the crap answers posted in Tenforums and Eightforums, I have come to conclusion that almost no one knows, how to turn off/on Airplane Mode without need to restart the system i.e. changing the registry setting for the same.

    Is it just me or all of 'em aren't aware that there is already an option in Taskbar that allows us to turn off/on Airplane mode without requiring system reboot. So it is definite sense that Airplane mode can and should be able to operate from Command Prompt/Batch file too, right?

    So the ultimate question, can anyone let me know how to do that from command line or batch file, without Registry editing and further rebooting the system ?

  • John
    John about 4 years
    Yes, deleting the GUID will disable the Airplane mode. I have done this. Airplane mode likes to muck with the wireless power saving feature causing it to turn off. More reason to delete it.
  • John
    John about 4 years
    Use powercfg /setactive {GUID of Airplane Plan} . That makes it active again. POWERCFG /? to see the commands
  • John
    John about 4 years
    Done - all updated answer
  • Vicky Dev
    Vicky Dev about 4 years
  • Vicky Dev
    Vicky Dev about 4 years
    Nice one dude, even though it interacts with GUI ultimately, but it does save lot of efforts, thanks a lot !!!
  • Io-oI
    Io-oI about 4 years
    Option # 1 does the same for the command line and the results/effects are also the same.
  • Vicky Dev
    Vicky Dev about 4 years
    This still needs the system to be rebooted, I mentioned in my question description, that I need to toggle without rebooting the system, just like GUI does it...
  • alejandro
    alejandro over 3 years
    Upvoted because editing the register actually helped me disable the airplane mode in my laptop (it was stuck). Did have to restart the computer after editing, like Vicky mentioned