How can I toggle Bluetooth on and off via a shortcut or script in Windows 8.1?

Solution 1:

Yes, it can be done. I'm not sure if this is the easiest way, but it works

Creating a batch file

  1. Create a new .bat file and call it something like bluetooth.bat
  2. Inside the file, paste the following script

The script checks if the Bluetooth Support Service (bthserv) is running.

If running, it stops the service. If stopped, it starts the service.

@echo off

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"
  )
)
  1. Save the .bat and then run it as an Administrator

Execution

If the service is stopped, you'll see:

If the service is running, you'll see:

If you want to stop the window from automatically closing, add a new line with @pause to the bottom of your script. Then you'll be prompted with Press any key to continue . . ..

Edit from comments:

The first time you use the batch file, add @pause to the bottom of the script and select y for any prompts that appear. Then test it out once more to make sure it's working as intended. If it is, you can remove @pause.

Always run as Administrator

If you want, which I assume you will, for the .bat to always run as Admin, do the following:

  1. Right click on your bluetooth.bat and click "Send to" -> "Desktop (Create Shortcut)

  1. Right click on the shortcut, click properties, then find the "Shortcut" tab at the top. Click "Advanced"

  1. Select "Run as Administrator"

  1. From now on, run the shortcut instead! All done.