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

1

1

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 ?

Vicky Dev

Posted 2020-02-25T01:23:32.743

Reputation: 353

Answers

1

  • #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*"

It Wasn't Me

Posted 2020-02-25T01:23:32.743

Reputation: 851

Nice one dude, even though it interacts with GUI ultimately, but it does save lot of efforts, thanks a lot !!! – Vicky Dev – 2020-02-26T01:45:30.960

Option # 1 does the same for the command line and the results/effects are also the same. – It Wasn't Me – 2020-02-26T05:30:37.887

0

You need to know the GUID for your machine for Airplane mode.

Open an admin Command Prompt.

powercfg -list to see the plans and the GUIDs

Then, powercfg /delete {GUID of Airplane Plan}.

To re-enable Airplane mode is different:

Start, Settings, Network, Airplane Mode, Enable.

You need Windows Settings after this. It is a specialized plan (because it turns off Wireless and Bluetooth) so it is best managed by Windows.

You can make batch files of the first setting (delete), but it is unique to each machine. It can be re-enabled later if needed. It is not a useful plan and I do not need it because I am much more likely to use my phone on a plane. So I delete the plan.

Note: It also appears the a Windows Creator Feature Upgrade deleted all but the Balanced Plan. I realized that I just have one plan, where I used to have 3 or 4. So in reality, Airplane Mode is definitely best managed by Windows. I do not need it and deleted it. You may feel the same way (or not). But Airplane Mode is there and manageable via Windows .

https://answers.microsoft.com/en-us/windows/forum/windows_10-power/power-plans-missing/9885bdc8-b11f-4722-9e11-423ef77494a9

John

Posted 2020-02-25T01:23:32.743

Reputation: 5 395

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 – 2020-02-25T01:34:54.557

Use powercfg /setactive {GUID of Airplane Plan} . That makes it active again. POWERCFG /? to see the commands – John – 2020-02-25T01:42:13.967

Done - all updated answer – John – 2020-02-25T01:45:47.993

Let us continue this discussion in chat.

– Vicky Dev – 2020-02-25T01:55:31.197

0

There is a registry key to do this:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\RadioManagement\SystemRadioState

(Default) DWORD

0 = Off 1 = On

Try this batch file:

@echo off
(
echo Windows Registry Editor Version 5.00
echo.
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\RadioManagement]
echo "SystemRadioState"=dword:0
) >temp.reg
reg import "temp.reg"

Wasif Hasan

Posted 2020-02-25T01:23:32.743

Reputation: 827

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... – Vicky Dev – 2020-02-26T22:35:07.003