:: Fixes CryptoPrevent Bulk installations that fail with a missing Chilkat dll error. :: Requires the VC++ 2010 x86 Runtime (vcredist_x86.exe) from here: https://www.microsoft.com/en-us/download/details.aspx?id=26999 :: Rename this file ending in .bat.txt to .bat (removing the .txt) in order to execute! @echo off&title "Fixing CryptoPrevent Bulk Installation..." pushd "%~dp0" if not exist vcredist_x86.exe goto :NoVCRedist :: check for admin permissions, returns errorlevel 0 on success (has admin) :: 'fsutil dirty query %systemdrive% >nul 2>&1' only works in XP and above (but NOT in WinPE, use 'net session >nul 2>&1' there) :: but 'net session >nul 2>&1' fails if the 'server' service is not started (e.g. in safe mode, or just broken) but should work :: in WinPE, and also like 'fsutil...' it returns errorlevel 0 on success, but also errorlevel 2 if 'server' service is not started fsutil dirty query %systemdrive% >nul 2>&1 :: fail if not errorlevel 0 (success) if %errorlevel% NEQ 0 goto :Fail :: Determine if 64bit paths should be used. Note that by using the syntax '%programfiles% (x86)' and not the single :: '%programfiles(x86)%' then we avoid any errors with the variable not existing and throwing off the actual exist check. :: if "[%programfiles(x86)%]" NEQ "[]" if exist "%programfiles% (x86)" set Win64=True :: if defined Win64 ( set "ProgramDir32=%programfiles(x86)%" ) else ( set "ProgramDir32=%programfiles%" ) :: install VC++ 2010 x86 Runtimes echo Installing the VC++ Runtimes, please wait... start "" /wait vcredist_x86.exe /passive /norestart :: re-run CryptoPrevent Bulk installation procedure pushd "%ProgramDir32%\Foolish IT\CryptoPrevent" echo CryptoPrevent is installing, this may take several minutes. echo This window will dissappear upon completion, please wait... start "" /wait CryptoPrevent.exe /bulkinstaller /silent :: exit batch goto :eof :NoVCRedist echo Missing 'vcredist_x86.exe' echo. echo Please download this file from the URL below and echo place in the same directory as this batch file. echo. echo https://www.microsoft.com/en-us/download/details.aspx?id=26999 echo. echo Press any key to exit... pause>nul goto :eof :Fail echo You must run this batch file as administrator! echo Press any key to exit... pause>nul