ngeninstall.cmd 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. @echo off
  2. setlocal
  3. rem Batch script for running ngen.exe for Medusa.
  4. @echo Warning! This script requires admin privileges.
  5. @echo Script automatically detects installation path of control center application.
  6. @echo.
  7. rem Looking for ngen.exe
  8. reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" /v InstallPath 1> nul 2> nul
  9. call :CheckStatus "[Error] ngen.exe not found."
  10. FOR /F "usebackq tokens=2,* skip=2" %%L IN (
  11. `reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" /v InstallPath`
  12. ) DO SET ngenpath=%%M
  13. rem If script is running with arguments then first argument is a path to control center Medusa.exe
  14. set console_path=
  15. set local_console_path=
  16. if not [%1]==[] (
  17. set console_path=%1
  18. ) else (
  19. rem Path to management console.
  20. if defined ControlCenterDir set console_path=%ControlCenterDir%\Medusa.exe
  21. if defined LocalControlCenterDir set local_console_path=%LocalControlCenterDir%\Medusa.exe
  22. )
  23. set _found=0
  24. rem Applying ngen for centralized management console.
  25. if not "%console_path%"=="" (
  26. @echo Centalized management console.
  27. @echo "%console_path%"
  28. call :CallNgen "%console_path%"
  29. set _found=1
  30. )
  31. rem Applying ngen for local management console.
  32. if not "%local_console_path%"=="" (
  33. @echo Local mode management console.
  34. @echo "%local_console_path%"
  35. call :CallNgen "%local_console_path%"
  36. set _found=1
  37. )
  38. if %_found%==0 (
  39. @echo Installed control center not found.
  40. @echo Please run script as "ngeninstall.cmd <Path to control center\Medusa.exe>"
  41. exit /B
  42. )
  43. exit /B
  44. rem ================================================================================
  45. :CheckStatus
  46. if %errorlevel% neq 0 (
  47. echo.
  48. echo %~1
  49. echo.
  50. pause
  51. )
  52. exit /b
  53. :CallNgen
  54. rem ================================================================================
  55. @echo --------------------------------------------------------------------------------
  56. "%ngenpath%\ngen.exe" install %1
  57. @echo --------------------------------------------------------------------------------
  58. @echo.