(view source code of bluetoothstatus.bat as plain text)
@ECHO OFF
IF NOT "%~1"=="" GOTO Syntax
DEVCON help >NUL 2>&1
IF ERRORLEVEL 1 (
ECHO.
ECHO ←[0;31mERROR:←[0m 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: ←[0;1mBluetoothStatus.bat←[0m
ECHO.
ECHO Notes: This batch file requires DEVCON, see
ECHO ←[0;1;30mhttps://www.robvanderwoude.com/devcon.php←[0m
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
page last modified: 2024-04-16; loaded in 0.0074 seconds