@echo off
REM Driver CX Intsallation, is required administrator right

REM set working folder as batch root directory
pushd %~dp0

REM delete log file and create one new
IF EXIST install.log (
    del install.log
)
echo %DATE%-%TIME% > install.log
echo driver version= 6.1.0.0 >> install.log


net session >nul 2>&1
if %errorLevel% == 0 (
   echo Success: Administrative permissions confirmed. >> install.log
   @echo off
	
   REM import certificate into MACHINE personal and root store 
   cd Install
   importpfx.exe -f certCamozziSpa.pfx -p "camozzi" -t MACHINE -s MY >> ..\install.log
   importpfx.exe -f certCamozziSpa.pfx -p "camozzi" -t MACHINE -s Root >> ..\install.log
   more ..\install.log

   REM setup driver after certificate imported 
   echo start setup.exe >> ..\install.log
   setup.exe
   echo end setup.exe >> ..\install.log
   cd..\

) else (
   echo Failure: Administator permissions is required!
   echo Failure: Administator permissions is required! >> install.log
   pause
)
