::http://support.microsoft.com/kb/2570538
::http://robrelyea.wordpress.com/2007/07/13/may-be-helpful-ngen-exe-executequeueditems/

if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto 64BIT

%windir%\microsoft.net\framework\v4.0.30319\ngen.exe update /force /queue
%windir%\microsoft.net\framework\v4.0.30319\ngen.exe executequeueditems

exit /b

:64BIT
%windir%\microsoft.net\framework\v4.0.30319\ngen.exe update /force /queue
%windir%\microsoft.net\framework64\v4.0.30319\ngen.exe update /force /queue
%windir%\microsoft.net\framework\v4.0.30319\ngen.exe executequeueditems
%windir%\microsoft.net\framework64\v4.0.30319\ngen.exe executequeueditems
::http://support.microsoft.com/kb/2570538
::http://robrelyea.wordpress.com/2007/07/13/may-be-helpful-ngen-exe-executequeueditems/

if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto 64BIT

if exist "%windir%\microsoft.net\framework\v4.0.30319\ngen.exe" (
  %windir%\microsoft.net\framework\v4.0.30319\ngen.exe update /force /queue
  %windir%\microsoft.net\framework\v4.0.30319\ngen.exe executequeueditems
)

exit /b

:64BIT
if exist "%windir%\microsoft.net\framework\v4.0.30319\ngen.exe" (
  %windir%\microsoft.net\framework\v4.0.30319\ngen.exe update /force /queue
  %windir%\microsoft.net\framework64\v4.0.30319\ngen.exe update /force /queue
  %windir%\microsoft.net\framework\v4.0.30319\ngen.exe executequeueditems
  %windir%\microsoft.net\framework64\v4.0.30319\ngen.exe executequeueditems
)

Check whether ngen.exe exists and execute only if it exists. Some versions of Windows 7 (e.g. without updates) do not include .NET Framework 4.0 by default.
Check whether ngen.exe exists and execute only if it exists. Some versions of Windows 7 (e.g. without updates) do not include .NET Framework 4.0 by default.
