How to turn on/off Airplane Mode(Windows 10) thro' Batch file or Command Prompt?
#1 option
Just use your command line or cmd/bat 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
#2 option
You can also use a hybrid bat file with the code vbs, 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*"
Related videos on Youtube
Vicky Dev
B.E. COMPUTER ENGG. WEB DEVELOPER (PHP/Magento/Wordpress/jQuery/Core Javascript/PrototypeJs/)
Updated on September 18, 2022Comments
-
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 about 4 yearsYes, 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 about 4 yearsUse powercfg /setactive {GUID of Airplane Plan} . That makes it active again. POWERCFG /? to see the commands
-
John about 4 yearsDone - all updated answer
-
Vicky Dev about 4 yearsLet us continue this discussion in chat.
-
Vicky Dev about 4 yearsNice one dude, even though it interacts with GUI ultimately, but it does save lot of efforts, thanks a lot !!!
-
Io-oI about 4 yearsOption # 1 does the same for the command line and the results/effects are also the same.
-
Vicky Dev about 4 yearsThis 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 over 3 yearsUpvoted 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