如何在Windows 10系统中使用CMD命令启动或关闭蓝牙?
如何在Windows 10系统中使用CMD命令启动或关闭蓝牙?
嘿,我刚好整理出了一个实用的批处理脚本方案,能帮你在Windows 10里通过CMD一键切换蓝牙的开/关状态,不用手动输入复杂命令,具体如下:
@echo off setlocal enabledelayedexpansion set "bluetoothStatus=" set "command=" :: Check current Bluetooth status for /f "tokens=3 delims=: " %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Radio Management" /v "Enable" ^| find "Enable"') do ( set "bluetoothStatus=%%a" ) if /i "%bluetoothStatus%"=="0x1" ( set "command=stop" ) else ( set "command=start" ) :: Execute the command if /i "%command%"=="start" ( echo Turning on Bluetooth... net start bthserv ) else ( echo Turning off Bluetooth... net stop bthserv ) :: Display the updated Bluetooth status for /f "tokens=3 delims=: " %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Radio Management" /v "Enable" ^| find "Enable"') do ( set "bluetoothStatus=%%a" ) if /i "%bluetoothStatus%"=="0x1" ( echo Bluetooth is now ON. ) else ( echo Bluetooth is now OFF. ) endlocal
使用步骤:
- 把上面的代码复制到记事本里,然后保存成后缀为
.bat的文件,比如laosBlue.bat - 双击这个批处理文件,它会自动检测当前蓝牙状态,然后切换到相反的状态(开变关,关变开)
重要提醒:
- 修改注册表和启停系统服务可能需要管理员权限,如果双击运行没生效,记得右键文件选择「以管理员身份运行」
- 操作注册表和系统服务有一定风险,使用这个脚本请自行承担后果哦
备注:内容来源于stack exchange,提问作者LAOMUSIC ARTS




