How can I script a bluetooth device to connect/disconnect? Announcing the arrival of Valued...
What makes a man succeed?
Crossing US/Canada Border for less than 24 hours
How do living politicians protect their readily obtainable signatures from misuse?
Karn the great creator - 'card from outside the game' in sealed
Would it be easier to apply for a UK visa if there is a host family to sponsor for you in going there?
How can I prevent/balance waiting and turtling as a response to cooldown mechanics
Dynamic filling of a region of a polar plot
If Windows 7 doesn't support WSL, then what is "Subsystem for UNIX-based Applications"?
How long can equipment go unused before powering up runs the risk of damage?
Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?
Prove that BD bisects angle ABC
What is an "asse" in Elizabethan English?
Co-worker has annoying ringtone
Random body shuffle every night—can we still function?
Putting class ranking in CV, but against dept guidelines
Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?
Lagrange four-squares theorem --- deterministic complexity
What initially awakened the Balrog?
Output Devanagari (Hindi) from raw unicode using luatex
preposition before coffee
Is there hard evidence that the grant peer review system performs significantly better than random?
What would you call this weird metallic apparatus that allows you to lift people?
What does Turing mean by this statement?
How does light 'choose' between wave and particle behaviour?
How can I script a bluetooth device to connect/disconnect?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Enable/Disable a network adapter with a keyboard shortcutConnect bluetooth headphones both to PC and phone at the same timeScripting connecting/disconnecting a paired Bluetooth deviceConnect bluetooth headphones both to PC and phone at the same timeWireless headset(bluetooth) connect with more than one device simultaneouslyHow do you connect or disconnect bluetooth devices on Windows 8.1?Force bluetooth headphones to connect with A2DP profile on WIndowsCannot connect Motorola S11 Flex-HD bluetooth headset with laptopHow can I output audio to Monster bluetooth Speakers?Force connect to Bluetooth deviceBluetooth headphones connect to “Forward VoIP Calls to Handsfree” but not to “Listen to Music”Sudden low volume in bluetooth headphonesHow to install Bluetooth on Windows 10 With No Device Manager Bluetooth Icon But Bluetooth Devices show up
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I have bluetooth headphones which I use to both listen to music from my mobile phone and to listen to videos on my laptop. They cannot be connected to both devices at once (note here), so I have to disconnect from one device before connecting to the next device.
To do this on Windows 7, I have to open Devices and Printers, open my bluetooth headphones, and click on the Connect/Disconnect button. I'd love to be able to run a script that triggers that Connect/Disconnect button. That way I could have a shortcut on the desktop or add a keyboard shortcut.
I've streamlined it somewhat by creating a shortcut to the bluetooth heaphones window (in Devices and Printers, right click on your bluetooth device and choose Create Shortcut). But it would be good to streamline further.
windows-7 bluetooth connection
add a comment |
I have bluetooth headphones which I use to both listen to music from my mobile phone and to listen to videos on my laptop. They cannot be connected to both devices at once (note here), so I have to disconnect from one device before connecting to the next device.
To do this on Windows 7, I have to open Devices and Printers, open my bluetooth headphones, and click on the Connect/Disconnect button. I'd love to be able to run a script that triggers that Connect/Disconnect button. That way I could have a shortcut on the desktop or add a keyboard shortcut.
I've streamlined it somewhat by creating a shortcut to the bluetooth heaphones window (in Devices and Printers, right click on your bluetooth device and choose Create Shortcut). But it would be good to streamline further.
windows-7 bluetooth connection
2
Yes. My computer does not have Bluetooth capabilities, but you can use AutoHotkey to automate the process. See my answer here for ideas: superuser.com/questions/403620/…
– iglvzx
Apr 4 '12 at 0:37
Thanks, good idea. I 'll try it out when I have a spare minute.
– David Cook
Apr 16 '12 at 1:22
@DavidCook Let us know if you get it sorted out, I'd love to grab a copy of that script.
– BigElittles
Jun 30 '16 at 16:45
Sorry @Big, I don't think I ever sorted it out. Glad you found a solution.
– David Cook
Jul 22 '16 at 3:46
add a comment |
I have bluetooth headphones which I use to both listen to music from my mobile phone and to listen to videos on my laptop. They cannot be connected to both devices at once (note here), so I have to disconnect from one device before connecting to the next device.
To do this on Windows 7, I have to open Devices and Printers, open my bluetooth headphones, and click on the Connect/Disconnect button. I'd love to be able to run a script that triggers that Connect/Disconnect button. That way I could have a shortcut on the desktop or add a keyboard shortcut.
I've streamlined it somewhat by creating a shortcut to the bluetooth heaphones window (in Devices and Printers, right click on your bluetooth device and choose Create Shortcut). But it would be good to streamline further.
windows-7 bluetooth connection
I have bluetooth headphones which I use to both listen to music from my mobile phone and to listen to videos on my laptop. They cannot be connected to both devices at once (note here), so I have to disconnect from one device before connecting to the next device.
To do this on Windows 7, I have to open Devices and Printers, open my bluetooth headphones, and click on the Connect/Disconnect button. I'd love to be able to run a script that triggers that Connect/Disconnect button. That way I could have a shortcut on the desktop or add a keyboard shortcut.
I've streamlined it somewhat by creating a shortcut to the bluetooth heaphones window (in Devices and Printers, right click on your bluetooth device and choose Create Shortcut). But it would be good to streamline further.
windows-7 bluetooth connection
windows-7 bluetooth connection
edited Mar 20 '17 at 10:17
Community♦
1
1
asked Apr 3 '12 at 23:53
David CookDavid Cook
8219
8219
2
Yes. My computer does not have Bluetooth capabilities, but you can use AutoHotkey to automate the process. See my answer here for ideas: superuser.com/questions/403620/…
– iglvzx
Apr 4 '12 at 0:37
Thanks, good idea. I 'll try it out when I have a spare minute.
– David Cook
Apr 16 '12 at 1:22
@DavidCook Let us know if you get it sorted out, I'd love to grab a copy of that script.
– BigElittles
Jun 30 '16 at 16:45
Sorry @Big, I don't think I ever sorted it out. Glad you found a solution.
– David Cook
Jul 22 '16 at 3:46
add a comment |
2
Yes. My computer does not have Bluetooth capabilities, but you can use AutoHotkey to automate the process. See my answer here for ideas: superuser.com/questions/403620/…
– iglvzx
Apr 4 '12 at 0:37
Thanks, good idea. I 'll try it out when I have a spare minute.
– David Cook
Apr 16 '12 at 1:22
@DavidCook Let us know if you get it sorted out, I'd love to grab a copy of that script.
– BigElittles
Jun 30 '16 at 16:45
Sorry @Big, I don't think I ever sorted it out. Glad you found a solution.
– David Cook
Jul 22 '16 at 3:46
2
2
Yes. My computer does not have Bluetooth capabilities, but you can use AutoHotkey to automate the process. See my answer here for ideas: superuser.com/questions/403620/…
– iglvzx
Apr 4 '12 at 0:37
Yes. My computer does not have Bluetooth capabilities, but you can use AutoHotkey to automate the process. See my answer here for ideas: superuser.com/questions/403620/…
– iglvzx
Apr 4 '12 at 0:37
Thanks, good idea. I 'll try it out when I have a spare minute.
– David Cook
Apr 16 '12 at 1:22
Thanks, good idea. I 'll try it out when I have a spare minute.
– David Cook
Apr 16 '12 at 1:22
@DavidCook Let us know if you get it sorted out, I'd love to grab a copy of that script.
– BigElittles
Jun 30 '16 at 16:45
@DavidCook Let us know if you get it sorted out, I'd love to grab a copy of that script.
– BigElittles
Jun 30 '16 at 16:45
Sorry @Big, I don't think I ever sorted it out. Glad you found a solution.
– David Cook
Jul 22 '16 at 3:46
Sorry @Big, I don't think I ever sorted it out. Glad you found a solution.
– David Cook
Jul 22 '16 at 3:46
add a comment |
2 Answers
2
active
oldest
votes
I found an a similar question, here is the resolution.
https://stackoverflow.com/questions/29724513/automatically-adding-a-bluetooth-device-in-windows-8
@ECHO OFF
if exist toggle.txt goto :2
btpair -u
C:NIRCMDNIRCMDC setdefaultsounddevice "CompSpeak" 1
C:NIRCMDNIRCMDC setdefaultsounddevice "CompSpeak" 2
echo toggle>>toggle.txt
exit
:2
btpair -n"[Samsung] AirTrack" -p0000
C:NIRCMDNIRCMDC setdefaultsounddevice "Headphones" 1
C:NIRCMDNIRCMDC setdefaultsounddevice "Headphones" 2
del toggle.txt /q
exit
OP said that he was getting a pop up message box, but he is also on windows 8 so that might be unique to his setup.
add a comment |
As it turns out, once all services in use by a device get disabled, device gets released and disconnected by Windows automatically. In my example case below for WH-1000XM3 these are voice and music, and most headphones will work the same way. This will of course depend on device in use.
You will need Bluetooth Command Line Tools.
Voice is actually the hands free service (HFP) and music is just an audio sink (A2DP). Service identifiers will be necessary and they can be discovered through the usage of btdiscovery
command from the package above, or via the list of Bluetooth services. HFP voice is 111e
, A2DP music is 110b
.
Per btcom
command line help:
Usage:
btcom {-c|-r} {-bBluetoothAddress | -nFriendlyName} [-s{sp|dun|GUID|UUID}]
-c Create association between COM port and a remote service (Enable non-COM service).
-r Remove association between COM port and a remote service (Disable non-COM service).
-s Remote service to use (Default is Serial Port Service)
-b Bluetooth address of remote device in (XX:XX:XX:XX:XX:XX) format.
-n Friendly name of remote device.
To disconnect the device, issue the following (only works when run as administrator in my case, using Windows 10 1809 (17763.437)):
"C:Program Files (x86)Bluetooth Command Line Toolsbinbtcom" -n "WH-1000XM3" -r -s111e
"C:Program Files (x86)Bluetooth Command Line Toolsbinbtcom" -n "WH-1000XM3" -r -s110b
To connect again, issue the same with -c
instead of -r
. This works for other devices, not just headphones, as long as all services/profiles connected to by Windows get disabled/enabled.
Note: using -n <friendly name>
is much slower than using -b <address>
due to performing Bluetooth discovery.
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f408302%2fhow-can-i-script-a-bluetooth-device-to-connect-disconnect%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I found an a similar question, here is the resolution.
https://stackoverflow.com/questions/29724513/automatically-adding-a-bluetooth-device-in-windows-8
@ECHO OFF
if exist toggle.txt goto :2
btpair -u
C:NIRCMDNIRCMDC setdefaultsounddevice "CompSpeak" 1
C:NIRCMDNIRCMDC setdefaultsounddevice "CompSpeak" 2
echo toggle>>toggle.txt
exit
:2
btpair -n"[Samsung] AirTrack" -p0000
C:NIRCMDNIRCMDC setdefaultsounddevice "Headphones" 1
C:NIRCMDNIRCMDC setdefaultsounddevice "Headphones" 2
del toggle.txt /q
exit
OP said that he was getting a pop up message box, but he is also on windows 8 so that might be unique to his setup.
add a comment |
I found an a similar question, here is the resolution.
https://stackoverflow.com/questions/29724513/automatically-adding-a-bluetooth-device-in-windows-8
@ECHO OFF
if exist toggle.txt goto :2
btpair -u
C:NIRCMDNIRCMDC setdefaultsounddevice "CompSpeak" 1
C:NIRCMDNIRCMDC setdefaultsounddevice "CompSpeak" 2
echo toggle>>toggle.txt
exit
:2
btpair -n"[Samsung] AirTrack" -p0000
C:NIRCMDNIRCMDC setdefaultsounddevice "Headphones" 1
C:NIRCMDNIRCMDC setdefaultsounddevice "Headphones" 2
del toggle.txt /q
exit
OP said that he was getting a pop up message box, but he is also on windows 8 so that might be unique to his setup.
add a comment |
I found an a similar question, here is the resolution.
https://stackoverflow.com/questions/29724513/automatically-adding-a-bluetooth-device-in-windows-8
@ECHO OFF
if exist toggle.txt goto :2
btpair -u
C:NIRCMDNIRCMDC setdefaultsounddevice "CompSpeak" 1
C:NIRCMDNIRCMDC setdefaultsounddevice "CompSpeak" 2
echo toggle>>toggle.txt
exit
:2
btpair -n"[Samsung] AirTrack" -p0000
C:NIRCMDNIRCMDC setdefaultsounddevice "Headphones" 1
C:NIRCMDNIRCMDC setdefaultsounddevice "Headphones" 2
del toggle.txt /q
exit
OP said that he was getting a pop up message box, but he is also on windows 8 so that might be unique to his setup.
I found an a similar question, here is the resolution.
https://stackoverflow.com/questions/29724513/automatically-adding-a-bluetooth-device-in-windows-8
@ECHO OFF
if exist toggle.txt goto :2
btpair -u
C:NIRCMDNIRCMDC setdefaultsounddevice "CompSpeak" 1
C:NIRCMDNIRCMDC setdefaultsounddevice "CompSpeak" 2
echo toggle>>toggle.txt
exit
:2
btpair -n"[Samsung] AirTrack" -p0000
C:NIRCMDNIRCMDC setdefaultsounddevice "Headphones" 1
C:NIRCMDNIRCMDC setdefaultsounddevice "Headphones" 2
del toggle.txt /q
exit
OP said that he was getting a pop up message box, but he is also on windows 8 so that might be unique to his setup.
edited May 23 '17 at 12:41
Community♦
1
1
answered Jul 6 '16 at 13:11
BigElittlesBigElittles
27919
27919
add a comment |
add a comment |
As it turns out, once all services in use by a device get disabled, device gets released and disconnected by Windows automatically. In my example case below for WH-1000XM3 these are voice and music, and most headphones will work the same way. This will of course depend on device in use.
You will need Bluetooth Command Line Tools.
Voice is actually the hands free service (HFP) and music is just an audio sink (A2DP). Service identifiers will be necessary and they can be discovered through the usage of btdiscovery
command from the package above, or via the list of Bluetooth services. HFP voice is 111e
, A2DP music is 110b
.
Per btcom
command line help:
Usage:
btcom {-c|-r} {-bBluetoothAddress | -nFriendlyName} [-s{sp|dun|GUID|UUID}]
-c Create association between COM port and a remote service (Enable non-COM service).
-r Remove association between COM port and a remote service (Disable non-COM service).
-s Remote service to use (Default is Serial Port Service)
-b Bluetooth address of remote device in (XX:XX:XX:XX:XX:XX) format.
-n Friendly name of remote device.
To disconnect the device, issue the following (only works when run as administrator in my case, using Windows 10 1809 (17763.437)):
"C:Program Files (x86)Bluetooth Command Line Toolsbinbtcom" -n "WH-1000XM3" -r -s111e
"C:Program Files (x86)Bluetooth Command Line Toolsbinbtcom" -n "WH-1000XM3" -r -s110b
To connect again, issue the same with -c
instead of -r
. This works for other devices, not just headphones, as long as all services/profiles connected to by Windows get disabled/enabled.
Note: using -n <friendly name>
is much slower than using -b <address>
due to performing Bluetooth discovery.
New contributor
add a comment |
As it turns out, once all services in use by a device get disabled, device gets released and disconnected by Windows automatically. In my example case below for WH-1000XM3 these are voice and music, and most headphones will work the same way. This will of course depend on device in use.
You will need Bluetooth Command Line Tools.
Voice is actually the hands free service (HFP) and music is just an audio sink (A2DP). Service identifiers will be necessary and they can be discovered through the usage of btdiscovery
command from the package above, or via the list of Bluetooth services. HFP voice is 111e
, A2DP music is 110b
.
Per btcom
command line help:
Usage:
btcom {-c|-r} {-bBluetoothAddress | -nFriendlyName} [-s{sp|dun|GUID|UUID}]
-c Create association between COM port and a remote service (Enable non-COM service).
-r Remove association between COM port and a remote service (Disable non-COM service).
-s Remote service to use (Default is Serial Port Service)
-b Bluetooth address of remote device in (XX:XX:XX:XX:XX:XX) format.
-n Friendly name of remote device.
To disconnect the device, issue the following (only works when run as administrator in my case, using Windows 10 1809 (17763.437)):
"C:Program Files (x86)Bluetooth Command Line Toolsbinbtcom" -n "WH-1000XM3" -r -s111e
"C:Program Files (x86)Bluetooth Command Line Toolsbinbtcom" -n "WH-1000XM3" -r -s110b
To connect again, issue the same with -c
instead of -r
. This works for other devices, not just headphones, as long as all services/profiles connected to by Windows get disabled/enabled.
Note: using -n <friendly name>
is much slower than using -b <address>
due to performing Bluetooth discovery.
New contributor
add a comment |
As it turns out, once all services in use by a device get disabled, device gets released and disconnected by Windows automatically. In my example case below for WH-1000XM3 these are voice and music, and most headphones will work the same way. This will of course depend on device in use.
You will need Bluetooth Command Line Tools.
Voice is actually the hands free service (HFP) and music is just an audio sink (A2DP). Service identifiers will be necessary and they can be discovered through the usage of btdiscovery
command from the package above, or via the list of Bluetooth services. HFP voice is 111e
, A2DP music is 110b
.
Per btcom
command line help:
Usage:
btcom {-c|-r} {-bBluetoothAddress | -nFriendlyName} [-s{sp|dun|GUID|UUID}]
-c Create association between COM port and a remote service (Enable non-COM service).
-r Remove association between COM port and a remote service (Disable non-COM service).
-s Remote service to use (Default is Serial Port Service)
-b Bluetooth address of remote device in (XX:XX:XX:XX:XX:XX) format.
-n Friendly name of remote device.
To disconnect the device, issue the following (only works when run as administrator in my case, using Windows 10 1809 (17763.437)):
"C:Program Files (x86)Bluetooth Command Line Toolsbinbtcom" -n "WH-1000XM3" -r -s111e
"C:Program Files (x86)Bluetooth Command Line Toolsbinbtcom" -n "WH-1000XM3" -r -s110b
To connect again, issue the same with -c
instead of -r
. This works for other devices, not just headphones, as long as all services/profiles connected to by Windows get disabled/enabled.
Note: using -n <friendly name>
is much slower than using -b <address>
due to performing Bluetooth discovery.
New contributor
As it turns out, once all services in use by a device get disabled, device gets released and disconnected by Windows automatically. In my example case below for WH-1000XM3 these are voice and music, and most headphones will work the same way. This will of course depend on device in use.
You will need Bluetooth Command Line Tools.
Voice is actually the hands free service (HFP) and music is just an audio sink (A2DP). Service identifiers will be necessary and they can be discovered through the usage of btdiscovery
command from the package above, or via the list of Bluetooth services. HFP voice is 111e
, A2DP music is 110b
.
Per btcom
command line help:
Usage:
btcom {-c|-r} {-bBluetoothAddress | -nFriendlyName} [-s{sp|dun|GUID|UUID}]
-c Create association between COM port and a remote service (Enable non-COM service).
-r Remove association between COM port and a remote service (Disable non-COM service).
-s Remote service to use (Default is Serial Port Service)
-b Bluetooth address of remote device in (XX:XX:XX:XX:XX:XX) format.
-n Friendly name of remote device.
To disconnect the device, issue the following (only works when run as administrator in my case, using Windows 10 1809 (17763.437)):
"C:Program Files (x86)Bluetooth Command Line Toolsbinbtcom" -n "WH-1000XM3" -r -s111e
"C:Program Files (x86)Bluetooth Command Line Toolsbinbtcom" -n "WH-1000XM3" -r -s110b
To connect again, issue the same with -c
instead of -r
. This works for other devices, not just headphones, as long as all services/profiles connected to by Windows get disabled/enabled.
Note: using -n <friendly name>
is much slower than using -b <address>
due to performing Bluetooth discovery.
New contributor
New contributor
answered 7 hours ago
MarcinJMarcinJ
1064
1064
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f408302%2fhow-can-i-script-a-bluetooth-device-to-connect-disconnect%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Yes. My computer does not have Bluetooth capabilities, but you can use AutoHotkey to automate the process. See my answer here for ideas: superuser.com/questions/403620/…
– iglvzx
Apr 4 '12 at 0:37
Thanks, good idea. I 'll try it out when I have a spare minute.
– David Cook
Apr 16 '12 at 1:22
@DavidCook Let us know if you get it sorted out, I'd love to grab a copy of that script.
– BigElittles
Jun 30 '16 at 16:45
Sorry @Big, I don't think I ever sorted it out. Glad you found a solution.
– David Cook
Jul 22 '16 at 3:46