答案1
尝试一下这个:(您需要管理权限)
$device = Get-PnpDevice | Where-Object {$_.Class -eq "Bluetooth" -and $_.FriendlyName -eq "FriendlyDeviceName"} Disable-PnpDevice -InstanceId $device.InstanceId -Confirm:$false Start-Sleep -Seconds 10 Enable-PnpDevice -InstanceId >$device.InstanceId -Confirm:$false
注意:这个脚本不是我的,我是从这里。
此外,您还可以使用以下工具: http://bluetoothinstaller.com/bluetooth-command-line-tools/
答案2
我也遇到了同样的问题,看起来像已经有它的快捷方式了:
Win+A然后点击连接
然而,我们可以通过创建一个巧妙的自动热键脚本使所有这一切只需一次击键即可实现。
#SingleInstance, force
CoordMode, Mouse, Screen
^!c:: ; Press Ctrl + Alt + C to start
; You'll need to find your Connect button's Screen coordinates with Window Spy.
connectButtonX = 1120
connectButtonY = 570
; You'll need to find your device entry's Screen coordinates with Window Spy.
deviceEntryX = 1130
deviceEntryY = 240
Send #a ;Win + A
WinWaitActive, ahk_exe Shellexperiencehost.exe,, 5
If ErrorLevel
Return
Sleep, 500
Click %connectButtonX%, %connectButtonY%
WinWaitActive, ahk_exe Shellexperiencehost.exe,, 5
If ErrorLevel
Return
Sleep, 1200
Click %deviceEntryX%, %deviceEntryY%
Send {Escape}