@echo off
:: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
@echo off

set ABSOLUTE_PATH=%cd%
set VL105_UPDATE_PATH=%ABSOLUTE_PATH%\VL105-Q6
set VL817_UPDATE_PATH=%ABSOLUTE_PATH%\VL817-Q7
set VL211_UPDATE_PATH=%ABSOLUTE_PATH%\VL211
set RTD2143_UPDATE_PATH=%ABSOLUTE_PATH%\RTD2143

echo.
echo.
echo.
echo==================================================================[PD_VL105,HUB1_VL817 Update]=======================================================
cd %ABSOLUTE_PATH%
cd %VL105_UPDATE_PATH%
call VIA_PD_Hub_FWUpdate.bat

@echo off
::echo==================================================================[HUB1_VL817 Update]===================================================
::cd %ABSOLUTE_PATH%
::cd %VL817_UPDATE_PATH%
::call VIA_PD_Hub_FWUpdate.bat

echo==================================================================[HUB1_VL211 Update]===================================================
cd %ABSOLUTE_PATH%
cd %VL211_UPDATE_PATH%
call UpdateFW.bat

echo==================================================================[MST_RTD2143 Check]===================================================
cd %ABSOLUTE_PATH%
cd %RTD2143_UPDATE_PATH%
call ISP.bat
pause
