Turn Bluetooth On/Off Windows 8.1 from Command Line Prompt
Asked Answered
M

2

7

Currently Windows 8.1 has users jumping through hoops to reach the settings that manage bluetooth connectivity (Charms->Settings->Change PC Settings->PC and Devices->Bluetooth->On/Off). I was wondering, is there any way to programmatically turn the bluetooth on/off from the command prompt? I just want to write code that basically does what the Windows OS appears to be doing from that settings screen, to simply switch the bluetooth on/off.

I don't want to simply make a shortcut link to the settings as some folks suggest. I'm challenging myself to write a script or program that can do this, but these past few days I've googled the net for information and at this point I'm not sure if it can even be done. I've even tried installing a Windows bluetooth command line library called "Bluetooth Command Line Tools" and tried using their "btconfig -c0" command, but it doesn't seem to work. Is there a language/approach/methodology that I can employ towards achieving this goal? Thanks!

Missionary answered 28/11, 2014 at 5:57 Comment(0)
S
0

From this answer from Microsoft Community, I think there is no way to do that.

There is no Microsoft software to access Bluetooth from command prompt.

How to enable Bluetooth and pair with a device using command line?

Look at this thread for Win10

Screwy answered 9/11, 2017 at 5:1 Comment(0)
L
0

Something like this should do the job:

for /F "tokens=3 delims=: " %%H in ('sc query "bthserv" ^| findstr "STATE"') do (
  if /I "%%H" NEQ "RUNNING" (
   net start "bthserv"
  ) else if /I "%%H" NEQ "STOPPED" (
   net stop "bthserv"
  )
)

This will check if Bluetooth service is running and if it is, it will stop it. If it is not, it will start the service.

Lightly answered 12/11, 2021 at 17:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.