I frequently switch between using my Galaxy Buds with my phone and computer. I've found the most trouble-free way to do this is to turn off bluetooth on one device and switch. What I would like to do it simply create a Windows 10 batch script that turns on bluetooth (if currently off), and connect to my buds. Is there any easy solution? It would save me like 4 clicks but I think I would appreciate the convenience.
You can use pnputil to disable or enable your Bluetooth driver using the pnputil driver servicing tool. As for specifically connecting to a bluetooth device through CMD, as far as I know, I don't believe that it is possible but I believe that you can in powershell.
(Looking at the Blutooth diagnostic files under C:\Windows\diagnostics\system\Bluetooth, they are all powershell and running it, may reset the driver, so it should be possible to use part of that code.)
# scan bluetooth devices
pnputil.exe /enum-devices /class bluetooth
# ... a long list of Bluetooth related items.
# Look for something like:
Instance ID: USB\VID_0CF3&PID_E500\5&2a9042b0&0&4
Device Description: Qualcomm Atheros QCA9377 Bluetooth
Class Name: Bluetooth
Class GUID: {e0cbf06c-cd8b-4647-bb8a-263b43f0f974}
Manufacturer Name: Qualcomm Atheros Communications
Status: Started
Driver Name: oem41.inf
# Disable this device:
$ pnputil.exe /disable-device "USB\VID_0CF3&PID_E500\5&2a9042b0&0&4"
Microsoft PnP Utility
Disabling device: USB\VID_0CF3&PID_E500\5&2a9042b0&0&4
System reboot is needed to complete configuration operations!
Take note of Device ID!
To re-enable:
$ pnputil.exe /enable-device "BTH\MS_BTHBRB\6&6d7d961&0&1"
Microsoft PnP Utility
Failed to enable device: BTH\MS_BTHBRB\6&6d7d961&0&1
Device is pending system reboot to complete a previous operation.
Don't listen, instead go into settings and toggle the Bluetooth flip a few times.
UPDATE: 2022-11-29
Strangely enough after having rebooted once, and now running the same pnutils commands in admin shell, I no longer get asked to reboot.
For completeness:

OFF.
ON.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With