Created
March 27, 2025 09:07
-
-
Save Youngv/a32ed35c4f9d68ee13843cb3a08166ff to your computer and use it in GitHub Desktop.
Restart Bluetooth devices after Windows 11 sleep.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
title Bluetooth Device Restart Tool | |
echo Restarting Bluetooth devices... | |
:: Check for admin privileges | |
NET SESSION >nul 2>&1 | |
if %ERRORLEVEL% neq 0 ( | |
echo ERROR: Please run this script as administrator! | |
echo Right-click the script and select "Run as administrator" | |
pause | |
exit | |
) | |
:: Define the Bluetooth device ID | |
set BT_DEVICE_ID="USB\VID_8087&PID_0032\6&2AF6C4ED&0&1" | |
echo Working with device ID: %BT_DEVICE_ID% | |
:: Using PowerShell to disable and enable the specific Bluetooth device | |
echo Disabling Bluetooth device... | |
powershell -NoProfile -ExecutionPolicy Bypass -Command "Disable-PnpDevice -InstanceId \"%BT_DEVICE_ID%\" -Confirm:$false" | |
echo Bluetooth device disabled, waiting 3 seconds before re-enabling... | |
timeout /t 3 /nobreak >nul | |
echo Enabling Bluetooth device... | |
powershell -NoProfile -ExecutionPolicy Bypass -Command "Enable-PnpDevice -InstanceId \"%BT_DEVICE_ID%\" -Confirm:$false" | |
echo. | |
echo Bluetooth device successfully restarted! | |
echo. | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment