问题描述
win10 蓝牙设备显示已配对,但是无法连接,且无法删除,在设备管理器界面卸载蓝牙设备和卸载驱动无效,重启后又全部回来了。
解决方案
下面提供两种方法,可以都试一下,亲测有效
方法一
- 下载 修复工具,一路默认选项完成安装。防止链接失效,附上 百度网盘链接
- 打开 Powershell,命令行输入 btpair -u,回车执行
- 等待会,就可以去设置把蓝牙设备删除了
方法二
- 打开 Powershell,命令行输入执行下面的代码
$Source = @"
[DllImport("BluetoothAPIs.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.U4)]
static extern UInt32 BluetoothRemoveDevice(IntPtr pAddress);
public static UInt32 Unpair(UInt64 BTAddress) {
GCHandle pinnedAddr = GCHandle.Alloc(BTAddress, GCHandleType.Pinned);
IntPtr pAddress = pinnedAddr.AddrOfPinnedObject();
UInt32 result = BluetoothRemoveDevice(pAddress);
pinnedAddr.Free();
return result;
}
"@
Function Get-BTDevice {
Get-PnpDevice -class Bluetooth |
?{$_.HardwareID -match 'DEV_'} |
select Status, Class, FriendlyName, HardwareID,
# Extract device address from HardwareID
@{N='Address';E={[uInt64]('0x{0}' -f $_.HardwareID[0].Substring(12))}}
}
################## Execution Begins Here ################
$BTR = Add-Type -MemberDefinition $Source -Name "BTRemover" -Namespace "BStuff" -PassThru
$BTDevices = @(Get-BTDevice) # Force array if null or single item
Do {
If ($BTDevices.Count) {
"`n******** Bluetooth Devices ********`n" | Write-Host
For ($i=0; $i -lt $BTDevices.Count; $i++) {
('{0,5} - {1}' -f ($i+1), $BTDevices[$i].FriendlyName) | Write-Host
}
$selected = Read-Host "`nSelect a device to remove (0 to Exit)"
If ([int]$selected -in 1..$BTDevices.Count) {
'Removing device: {0}' -f $BTDevices[$Selected-1].FriendlyName | Write-Host
$Result = $BTR::Unpair($BTDevices[$Selected-1].Address)
If (!$Result) {"Device removed successfully." | Write-Host}
Else {"Sorry, an error occured." | Write-Host}
}
}
Else {
"`n********* No devices foundd ********" | Write-Host
}
} While (($BTDevices = @(Get-BTDevice)) -and [int]$selected)
- 执行完后,选择你要删除的设备,然后就可以去设置里把蓝牙设备删除了
声明:本站部分资源搜集自网络,相关版权归版权持有人所有,如有侵权,请联络我们,本站会尽快删除。