rem Make the smart card service always running

@rem Check for admin rights
@fsutil dirty query %systemdrive% >nul 2>&1
@IF ERRORLEVEL 1 goto adminerror
goto adminok

:adminerror
@echo The script must be run by an administrator
@pause
@goto end

:adminok

rem Remove any trigger that should start the service but does it really too slowly
sc triggerinfo scardsvr delete
sc triggerinfo ScDeviceEnum delete

rem Start service automatically at startup
sc config scardsvr start=auto
sc config ScDeviceEnum start=auto

rem Make sure it is started now 
sc start scardsvr
sc start ScDeviceEnum

:end
