百度了无数次,surface pro 7 的解锁蓝牙失灵问题已经成为苏菲系列的通病
研究了一个小时,终于做出了针对苏菲蓝牙失灵问题的补丁。
分析:Windows10只有在用户长时间未登录时会产生此问题,
【伸手党福利】直接放一个补丁下载地址:
https://download.csdn.net/download/wwppp987/15506813
解压到c盘根目录(目录已经创建好了,直接解压即可),然后将xml文件导入到计划任务中即可。
本补丁针对win10,别的版本请看下原理,原理是相通的。
1、powershell开权限
C:\Windows\WinSxS
下搜索powershell.exe
,右键使用管理员权限运行
输入
Set-ExecutionPolicy Unrestricted
选择全是【a】
否则之后运行程序会报错
项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次
参考:https://blog.csdn.net/f786587718/article/details/76762461
2、建立C:\BlueTeethReboot
文件夹并建立三个文件:
三个文件内容:
1.bat
@echo off
powershell -command C:\BlueTeethReboot\1.ps1 -BluetoothStatus Off
choice /t 1 /d y /n >nul
powershell -command C:\BlueTeethReboot\1.ps1 -BluetoothStatus On
1.ps1
[CmdletBinding()] Param (
[Parameter(Mandatory=$true)][ValidateSet('Off', 'On')][string]$BluetoothStatus
)
If ((Get-Service bthserv).Status -eq 'Stopped') { Start-Service bthserv }
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType) {
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result
}
[Windows.Devices.Radios.Radio,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
[Windows.Devices.Radios.RadioAccessStatus,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ([Windows.Devices.Radios.Radio]::RequestAccessAsync()) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
$radios = Await ([Windows.Devices.Radios.Radio]::GetRadiosAsync()) ([System.Collections.Generic.IReadOnlyList[Windows.Devices.Radios.Radio]])
$bluetooth = $radios | ? { $_.Kind -eq 'Bluetooth' }
[Windows.Devices.Radios.RadioState,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ($bluetooth.SetStateAsync($BluetoothStatus)) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
1.vbs
set ws=WScript.CreateObject("WScript.Shell")
ws.Run "c:\BlueTeethReboot\1.bat",0
这三个文件的目的是重启蓝牙模块,根手动关闭和打开没有区别。
3、建立计划任务
在计划任务中,找到Microsoft》Windows下,右键》创建基本任务
1、填写名字,
2、当前用户登录时
3、启动程序
4、选择1.vbs
5、创建完成,然后右键》属性》勾选使用最高权限运行、隐藏
6、完成效果图:
效果:用户在登录时候自动关闭1秒后重启蓝牙模块。
导致用户在系统登录之初蓝牙掉线,但是恢复速度很快,总体掉线时间一般不会超过2秒。
对于苏菲这种非性能笔记本来说这点时间我还是等得起的。
优点:用户锁屏时候不会运行此脚本,而是在用户注销或者重启机器时候运行。
强烈推荐拥有苏菲的同志们使用此脚本~~