@echo off
set root=%CD%

::Checking OS architechture.
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OSarch=32BIT || set OSarch=64BIT

echo.
echo Installing Realtek Media Card Reader Driver. Please wait...
echo.

if %OSarch%==32BIT ( 
	cd DrvBin32
) else if %OSarch%==64BIT ( 
	cd DrvBin64
) else (
	goto ERROR
)

::Install driver in Silent mode.
DpInst.exe /q /se /sa /sw

::Check return value.
if errorlevel 0 (
	echo Installation completed.
	goto END
) else (
	goto ERROR
)

:ERROR
echo.
echo Error: An error occured while installing the driver.
goto END

:END
cd %ROOT%
