修复蓝牙耳机音频问题

Windows 11更新后,蓝牙连接耳机无法播放声音而只能当话筒,想办法彻底解决这个问题,写了一个脚本出来

#
# 脚本修复Windows 11蓝牙耳机只能作为话筒但不能播放声音的问题
# 以管理员权限运行此脚本

# 检查管理员权限
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
    Write-Warning "请以管理员权限运行此脚本!"
    break
}

Write-Host "正在修复蓝牙耳机音频问题..." -ForegroundColor Cyan

# 1. 重启相关的音频服务
Write-Host "步骤1: 重启音频服务..." -ForegroundColor Yellow
$audioServices = @("Audiosrv", "AudioEndpointBuilder", "BthAvctpSvc")
foreach ($service in $audioServices) {
    Stop-Service -Name $service -Force -ErrorAction SilentlyContinue
    Start-Service -Name $service -ErrorAction SilentlyContinue
    $status = Get-Service -Name $service -ErrorAction SilentlyContinue
    if ($status.Status -eq "Running") {
        Write-Host "  - 服务 $service 已重启" -ForegroundColor Green
    } else {
        Write-Host "  - 服务 $service 重启失败或不存在" -ForegroundColor Red
    }
}

# 2. 重置蓝牙子系统
Write-Host "步骤2: 重置蓝牙子系统..." -ForegroundColor Yellow
Get-Service bthserv | Stop-Service -Force
Start-Sleep -Seconds 2
Get-Service bthserv | Start-Service
Write-Host "  - 蓝牙服务已重置" -ForegroundColor Green

# 3. 清除并重新注册音频组件
Write-Host "步骤3: 重置音频组件..." -ForegroundColor Yellow
cmd /c "regsvr32 /s wmnetmgr.dll"
cmd /c "regsvr32 /s /u wmnetmgr.dll"
cmd /c "regsvr32 /s wmnetmgr.dll"
Write-Host "  - 音频组件已重置" -ForegroundColor Green

# 4. 重置声音设置
Write-Host "步骤4: 重置Windows音频设置..." -ForegroundColor Yellow
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Multimedia\Audio" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio" -Recurse -Force -ErrorAction SilentlyContinue
Write-Host "  - 音频设置已重置" -ForegroundColor Green

# 5. 检查蓝牙驱动
Write-Host "步骤5: 检查蓝牙驱动更新..." -ForegroundColor Yellow
$bluetoothDevices = Get-PnpDevice | Where-Object { $_.Class -eq "Bluetooth" }
if ($bluetoothDevices) {
    foreach ($device in $bluetoothDevices) {
        Write-Host "  - 找到蓝牙设备: $($device.FriendlyName)" -ForegroundColor Green
    }
    Write-Host "  - 提示: 建议到设备管理器检查驱动是否为最新版本" -ForegroundColor Yellow
} else {
    Write-Host "  - 未找到蓝牙设备" -ForegroundColor Red
}

Write-Host "`n修复完成!请按照以下步骤操作:" -ForegroundColor Cyan
Write-Host "1. 移除蓝牙耳机连接" -ForegroundColor White
Write-Host "2. 重启电脑" -ForegroundColor White
Write-Host "3. 重新连接蓝牙耳机" -ForegroundColor White
Write-Host "4. 右键点击系统托盘的声音图标,选择'打开声音设置'" -ForegroundColor White
Write-Host "5. 确保蓝牙耳机被设置为默认播放设备" -ForegroundColor White
Write-Host "6. 如果仍有问题,尝试进入蓝牙设备属性,检查'服务'选项卡中的'音频'选项是否启用" -ForegroundColor White

Read-Host -Prompt "按回车键退出"

使用说明:

  1. 将此代码保存为Fix-BluetoothAudio.ps1文件
  2. 以管理员身份运行PowerShell
  3. 执行脚本:.\Fix-BluetoothAudio.ps1
  4. 按照脚本结束时的提示进行操作

此脚本会重启音频服务、重置蓝牙堆栈、重新注册音频组件并清除相关注册表项,应该是能解决Windows 11更新后蓝牙耳机无法播放声音的问题。

Category
Tagcloud
CUDA Hadoop Data Hardware Remote Linux Geology FuckZhihu Kivy QEMU VTK VM Memory Pyenv GIS Translate Junck Tape Science ML Data Science 蓝牙 AI NixOS Learning Photo n8n VirtualMachine Communicate Mac SKill HBase LLM Virtual Machine OpenCL Poem Tools Mount&Blade TUNA Windows11 Code Algorithm Agent 耳机 AdamW LTO Book Lens GlumPy Prompt Microscope Scholar Cursor Windows QGIS ChromeBook LlamaFactory OpenWebUI University AI,Data Science Visualization PHD PVE Hack GPT-OSS Virtualization Game Story Life SandBox Photography RTL-SDR Qwen3 FckZhiHu Code Generation Radio 音频 macOS C Tool Shit History MayaVi Ubuntu Camera Hackintosh LTFS AIGC Turing Nvidia Python Computability OSX-KVM Ollama Muon FuckChunWan Discuss Optimization PyOpenCL Programming