@ECHO OFF IF NOT "%~1"=="" GOTO Syntax DEVCON help >NUL 2>&1 IF ERRORLEVEL 1 ( ECHO. ECHO ERROR: DEVCON not found GOTO Syntax ) SETLOCAL FOR /F %%A IN ('devcon.exe findall ^=Bluetooth @BTH*') DO SET CountAll=%%A FOR /F %%A IN ('devcon.exe find ^=Bluetooth @BTH*') DO SET CountAct=%%A IF %CountAll% GTR 0 IF %CountAll% EQU %CountAct% ( ECHO Bluetooth Enabled SET RC=0 ) ELSE ( ECHO Bluetooth Disabled SET RC=1 ) ENDLOCAL & EXIT /B %RC% GOTO:EOF :Syntax ECHO. ECHO BluetoothStatus.bat, Version 1.00 ECHO Use DEVCON to check if Bluetooth is enabled ECHO. ECHO Usage: BluetoothStatus.bat ECHO. ECHO Notes: This batch file requires DEVCON, see ECHO https://www.robvanderwoude.com/devcon.php ECHO Return code ("ErrorLevel") 0 if Bluetooth is ECHO enabled, 1 if not, or -1 in case of errors. ECHO. ECHO Written by Rob van der Woude ECHO https://www.robvanderwoude.com EXIT /B -1