Loading... ### 问题说明 笔记本(Windows10专业版 20H2)最近连接蓝牙键盘(罗技k480)一直有问题,总是连接异常,要么是连不上,要么就是连上后出现在“其他设备”而不是“鼠标、键盘和笔”下。之后神奇的事情就出现了,在“其他设备”下显示键盘已配对,但是实际上键盘并不能用,而且这个设备点击删除也删不掉,怎么删也删不掉。 ### 寻找解决办法 首先搜索了如何将笔记本蓝牙初始化,但是并没有找到解决办法,仿佛要改注册表,有点麻烦而且不敢动注册表。然后搜索了如何彻底删除蓝牙设备,在CSDN上找到了一个解决办法[Win10彻底删除蓝牙设备_一木扶苏-CSDN博客_win10蓝牙设备删除失败](https://blog.csdn.net/u014595375/article/details/85730427)尝试后,确实将顽固的键盘删除掉了。但是重新连接时还是失败了,连接了好几次还是出现了“其他设备”下。在该贴的评论中找到了其他方法解决了根本问题。 ### 成功方法 [How to completely remove a Bluetooth device from Win 10? Solved - Page 3 - Windows 10 Forums (tenforums.com)](https://www.tenforums.com/drivers-hardware/22049-how-completely-remove-bluetooth-device-win-10-a-3.html) 1. 右键点击Windows徽标,打开powershell命令窗口 ![打开powershell窗口.jpg](https://yzhyy.oss-cn-shanghai.aliyuncs.com/yu520/2021/04/23/2021-04-23_LI.jpg) 2. 复制粘贴以下代码到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) ```` 3. 输入数字选择要删除的设备,比如这里我要删除`K480`,输入`1`回车就会删除该设备,之后输入`0`可以退出。 ![powershell.jpg](https://yzhyy.oss-cn-shanghai.aliyuncs.com/yu520/2021/04/23/QQ截图20210423220142.jpg) 最后修改:2021 年 04 月 24 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏