Skip to content

Instantly share code, notes, and snippets.

@racsonp
Created March 8, 2012 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save racsonp/1999576 to your computer and use it in GitHub Desktop.
Save racsonp/1999576 to your computer and use it in GitHub Desktop.
VS2010andSP1_InstallAutomatically
::check to determine if the batch script is processed in an elevated process.
@reg add HKLM\Software\Microsoft\DevDiv\0b3d680166a14e50a8c8e2ed060d8d90 /v Elevated /t REG_DWORD /d 1 /f > nul 2>&1
@if /i "%errorlevel%"=="1" echo Error: elevation required. &exit /b 740
@reg delete HKLM\Software\Microsoft\DevDiv\0b3d680166a14e50a8c8e2ed060d8d90 /va /f > nul 2>&1
:: Install VS2010
"%~dp0setup\setup.exe" /q /norestart /unattendfile "%~dp0VS2010_deployment.ini"
:: For full install, comment the line above and uncomment the next line ( Remember you need to create your own "unattend.ini" file
::"%~dp0setup\setup.exe" /q /norestart "
@if /i "%errorlevel%"=="3010" (echo Returned 3010: Need to reboot when setup is complete.) else (
if /i "%errorlevel%"=="3015" (echo Returned 3015: Need to reboot and restart setup. &exit /b %errorlevel%) else (
if /i "%errorlevel%"=="0" (echo Returned 0: Install completed succeeded.) else (
echo Returned %errorlevel%: Install failed. &exit /b %errorlevel%)))
:: Install SP1
"%~dp0SP1\setup.exe" /q
@if /i "%errorlevel%"=="3010" (echo Returned 3010: Need to reboot when setup is complete.) else (
if /i "%errorlevel%"=="3015" (echo Returned 3015: Need to reboot and restart setup. &exit /b %errorlevel%) else (
if /i "%errorlevel%"=="0" (echo Returned 0: Install completed succeeded.) else (
echo Returned %errorlevel%: Install failed. &exit /b %errorlevel%)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment