@echo off
setlocal EnableExtensions
title HWScan uninstall
set "HWSCAN_HOME=%LOCALAPPDATA%\HWScan"
set "HWSCAN_KEY=HKCU\Software\Classes\hwscan"

echo.
echo HWScan uninstall
echo Removes the hwscan:// handler and the folder it was installed into:
echo   %HWSCAN_HOME%
echo No administrator rights are needed.
echo.

reg query "%HWSCAN_KEY%" >nul 2>&1
if errorlevel 1 (
    echo [1/2] hwscan:// was not registered for this account.
) else (
    reg delete "%HWSCAN_KEY%" /f >nul 2>&1
    if errorlevel 1 (
        echo [1/2] Could not remove the hwscan:// registration.
    ) else (
        echo [1/2] hwscan:// handler removed.
    )
)

if exist "%HWSCAN_HOME%" (
    rmdir /s /q "%HWSCAN_HOME%" 2>nul
    if exist "%HWSCAN_HOME%" (
        echo [2/2] Could not delete "%HWSCAN_HOME%".
        echo       Close windows opened in that folder, then run this file again.
        echo.
        pause
        exit /b 1
    )
    echo [2/2] Folder deleted, including hardware.json and generated reports.
) else (
    echo [2/2] The HWScan folder was already gone.
)

echo.
echo Done. Check Hardware now reads browser signals only.
echo.
pause
exit /b 0
