@ECHO OFF
SETLOCAL
REG ADD HKLM /F>nul 2>&1
IF ERRORLEVEL 1 GOTO noAdmin

SET Lib_DRIVE=%~d0
SET Lib_PATH=%~p0
%Lib_DRIVE%
CD "%Lib_PATH%"

REG QUERY "HKLM\Hardware\Description\System\CentralProcessor\0" | FIND /i "x86" > NUL && SET OS=32BIT || SET OS=64BIT

IF %OS%==32BIT SET syswindir=%windir%\System32
IF %OS%==64BIT SET syswindir=%windir%\SysWOW64

IF NOT EXIST "%syswindir%\mscomctl.ocx" COPY mscomctl.ocx "%syswindir%"

regsvr32 /u "%syswindir%\mscomctl.ocx"
regsvr32 "%syswindir%\mscomctl.ocx"
GOTO :EOF

:noAdmin
ECHO This script must run with elevated privileges, so:
ECHO.
ECHO   right click on it, choose "run as administrator"
ENDLOCAL
ECHO.
ECHO.
ECHO.
PAUSE