@echo off

set CHROME=chrome.exe
set REGPATH=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\%CHROME%

reg query "%REGPATH%" >nul 2>nul

if %ERRORLEVEL% == 1 (goto err)

for /f "tokens=2,*" %%i in ('reg query "%REGPATH%" /v "Path"') do (
    set PATH=%%j
)

if not exist "%PATH%\%CHROME%" (goto err)

set /p OPTIONS= <%CD%\sdk-wrt-options.txt
start /d "%PATH%" %CHROME% %OPTIONS% --app="file://%CD%/web/index.html" --user-data-dir=%CD%/sdk-profile-data/
exit

:err
echo ATTENTIONS: Google Chrome is required to be installed before launching Web Simulator.
pause
