@echo off setlocal rem Batch script for running ngen.exe for Medusa. @echo Warning! This script requires admin privileges. @echo Script automatically detects installation path of control center application. @echo. rem Looking for ngen.exe reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" /v InstallPath 1> nul 2> nul call :CheckStatus "[Error] ngen.exe not found." FOR /F "usebackq tokens=2,* skip=2" %%L IN ( `reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" /v InstallPath` ) DO SET ngenpath=%%M rem If script is running with arguments then first argument is a path to control center Medusa.exe set console_path= set local_console_path= if not [%1]==[] ( set console_path=%1 ) else ( rem Path to management console. if defined ControlCenterDir set console_path=%ControlCenterDir%\Medusa.exe if defined LocalControlCenterDir set local_console_path=%LocalControlCenterDir%\Medusa.exe ) set _found=0 rem Applying ngen for centralized management console. if not "%console_path%"=="" ( @echo Centalized management console. @echo "%console_path%" call :CallNgen "%console_path%" set _found=1 ) rem Applying ngen for local management console. if not "%local_console_path%"=="" ( @echo Local mode management console. @echo "%local_console_path%" call :CallNgen "%local_console_path%" set _found=1 ) if %_found%==0 ( @echo Installed control center not found. @echo Please run script as "ngeninstall.cmd " exit /B ) exit /B rem ================================================================================ :CheckStatus if %errorlevel% neq 0 ( echo. echo %~1 echo. pause ) exit /b :CallNgen rem ================================================================================ @echo -------------------------------------------------------------------------------- "%ngenpath%\ngen.exe" install %1 @echo -------------------------------------------------------------------------------- @echo.