@echo off
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
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 fwfile=test.bin
SETLOCAL EnableDelayedExpansion

cd 5423
call :findfwfile
echo Update RTS5423
echo fwfile is %fwfile%
RHC.exe -level 1 -flash RTS5423_DS_UCE6_V018_20210226.bin
if  %errorlevel%==0 echo RTS5423 Download Pass
echo %errorlevel%
cd ..
call delay5s.bat

:findfwfile
set suffix=.bin
::set pwd=%~dp0
for /R "%cd%" %%i in (*) do (
set filename=%%~nxi
call :check %%~xi
)
goto :eof

:check
for %%i in (%suffix%) do (
if "%1"=="%%i" set fwfile=%filename%
)
goto :eof