共用方式為


Update regarding silent install of the VC 8.0 runtime (vcredist) packages

A while back, I posted this item on my blog that describes options for silent installation of the Visual C++ 8.0 runtime redistributable setup packages.  When I investigated this issue and wrote that blog post, I based the command line parameters on the versions of vcredist_x86.exe, vcredist_x64.exe and vcredist_ia64.exe that are included in the directory %ProgramFiles%\Microsoft Visual Studio 8\SDK\v2.0\Bootstrapper\Packages when installing Visual Studio 2005.

However, a customer recently alerted me to an issue that I wasn't aware of previously.  The standalone versions of the VC runtime redistributable packages that are available for download via the web are packaged differently, and so the command lines that I previously documented for silent installation will not work with those versions of the packages.  Essentially, the standalone versions are wrapped in a second self-extracting EXE that displays a EULA before allowing extraction and execution of the main setup package, whereas the packages included as part of Visual Studio 2005 directly launch setup and are not doubly wrapped.

Therefore, here are some amended silent install instructions for the VC 8.0 runtime redistributable packages.  If you are using the packages included as a part of Visual Studio 2005, you can continue to use the silent install switches from my previous blog post.

However, if you have downloaded the standalone VC 8.0 redistributable packages, you will need to modify the command lines slightly.  The following command lines can be used to install the original release of the standalone VC 8.0 redistributable packages:

  • For x86: vcredist_x86.exe /q:a /c:"VCREDI~1.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "
  • For x64: vcredist_x64.exe /q:a /c:"VCREDI~2.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "
  • For ia64: vcredist_ia64.exe /q:a /c:"VCREDI~3.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "

The following command lines can be used to install the Visual Studio 2005 SP1 release of the standalone VC 8.0 redistributable packages:

  • For x86: vcredist_x86.exe /q:a /c:"VCREDI~3.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "
  • For x64: vcredist_x64.exe /q:a /c:"VCREDI~2.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "
  • For ia64: vcredist_ia64.exe /q:a /c:"VCREDI~1.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "

The following command lines can be used to install the Visual Studio 2005 SP1 ATL Security Update release of the standalone VC 8.0 redistributable packages:

  • For x86: vcredist_x86.exe /q:a /c:"VCREDI~3.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "
  • For x64: vcredist_x64.exe /q:a /c:"VCREDI~2.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "
  • For ia64: vcredist_ia64.exe /q:a /c:"VCREDI~1.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "

If you would like to install the VC runtime packages in unattended mode (which will show a small progress bar but not require any user interaction), you can change the /qn switch above to /qb.  If you would like the progress bar to not show a cancel button, then you can change the /qn switch above to /qb!

<update date="4/25/2007"> Added new command lines for the VS 2005 SP1 version of the VC 8.0 redistributable packages </update>

<update date="7/29/2007"> Updated command line switches to distinguish between unattended install mode and silent install mode </update>

<update date="10/16/2009"> Added information about the command lines for the VC++ 2005 SP1 ATL Security Update package. </update>

Comments

  • Anonymous
    February 13, 2007
    Aaron has a post on his blog that describes way of silent install of VCRedist.EXE. I though I would cross-link

  • Anonymous
    March 13, 2007
    I have previously posted a few items about deploying the Visual C++ 8.0 runtime redistributable packages

  • Anonymous
    April 24, 2007
    I previously wrote a blog post about updated versions of the Visual C++ 8.0 runtime files that shipped

  • Anonymous
    April 25, 2007
    It looks like in the SP1 version of the libraries, the internal files have different names: For x86: vcredist_x86.exe /q:a /c:"VCREDI~3.EXE /q:a /c:""msiexec /i vcredist.msi /qb!"" " appears to be the right way to go for x86. For x64 it remains unchanged. Anthony Wieser Wieser Software Ltd

  • Anonymous
    April 25, 2007
    The comment has been removed

  • Anonymous
    June 13, 2007
    Thank you. Very useful info.

  • Anonymous
    July 30, 2007
    I am still having problems getting the vcredist_x86 to install silently. I am using Microsoft Visual Studio 2005 and the downloaded version of the VC++ redist. I am modifing the bootstraper Product.XML. When I look inside the self-extracting file vcredist_x86.exe I can see that it contains the VCREDI~3.EXE file. So in my C:Program FilesMicrosoft Visual Studio 8SDKv2.0BootStrapperPackagesvcredist_x86product.xml I am using: vcredist_x86.exe /q:a /c:"VCREDI~3.EXE /q:a /c:""msiexec /i vcredist.msi /qb!"" ".   This does not seem to work silently! ++++++++++++++++++++++++++++++++++++++++ <?xml version="1.0" encoding="utf-8" ?> <Product  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"  ProductCode="Microsoft.Visual.C++.8.0.x86" >  <!-- Defines list of files to be copied on build -->  <PackageFiles>    <PackageFile Name="vcredist_x86.exe"/>  </PackageFiles>  <InstallChecks>    <MsiProductCheck Property="VCRedistInstalled" Product="{A49F249F-0C91-497F-86DF-B2585E8E76B7}"/>  </InstallChecks>  <!-- Defines how to invoke the setup for the Visual C++ 8.0 redist -->  <!-- TODO: Needs EstrimatedTempSpace, LogFile, and an update of EstimatedDiskSpace -->  <Commands Reboot="Defer">    <Command PackageFile="vcredist_x86.exe"     Arguments=' /q:a /c:"VCREDI~3.EXE /q:a /c:""msiexec /i vcredist.msi /qb!"" "'>      <!-- These checks determine whether the package is to be installed -->      <InstallConditions>        <BypassIf Property="VCRedistInstalled" Compare="ValueGreaterThanOrEqualTo" Value="3"/>        <!-- Block install if user does not have admin privileges -->        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>        <!-- Block install on Win95 -->        <FailIf Property="Version9X" Compare="VersionLessThan" Value="4.10" String="InvalidPlatformWin9x"/>        <!-- Block install on NT 4 or less -->        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.00" String="InvalidPlatformWinNT"/>      </InstallConditions>      <ExitCodes>        <ExitCode Value="0" Result="Success"/>        <ExitCode Value="3010" Result="SuccessReboot"/>        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />      </ExitCodes>    </Command>  </Commands> </Product> Any help in getting this to perform a silent-no-UI install is greatly appreciated.

  • Anonymous
    July 30, 2007
    The comment has been removed

  • Anonymous
    July 31, 2007
    The comment has been removed

  • Anonymous
    July 31, 2007
    Hi Scott - Unfortunately, the bootstrapper setup.exe that is created by the Visual Studio setup/deployment projects does not support fully silent installs of packages that it chains.  The command lines I listed in this blog post are not helpful in that scenario, but they will work if you are running the VC redist package directly (and not via the VS setup/deployment bootstrapper).  I'm sorry for the hassles.

  • Anonymous
    April 02, 2008
    Very useful information, thanks. Does anyone have a list of possible return codes? I would like to install it as a prerequisite and I could need a return code if a reboot is required.

  • Anonymous
    April 02, 2008
    Hi HolgerG - The return codes for the VC redist packages follow a traditional setup return code pattern, as follows: 0 = success, no reboot required 3010 = success, reboot required any other value = failure

  • Anonymous
    April 25, 2008
    Thank-you! Newbie, perhaps silly question: What is the command to uninstall the package? I tried /x, that seemed to make it attempt to extract all files. How do most people handle the dilemma of deciding whether to uninstall VC redist or not? Prompting may confuse the user but silently removing it may break other programs.

  • Anonymous
    April 25, 2008
    Hi Raboyd - The silent uninstall would need to look something like this (as an example, I'm using the x86 package listed above in this blog post): vcredist_x86.exe /q:a /c:"VCREDI~1.EXE /q:a /c:""msiexec /x vcredist.msi /qn"" " In general, your application should not attempt to uninstall the VC redistributable package as a part of your uninstall because it could be needed by other applications on the system.  This recommendation holds for other redistributable programs that you might install as a part of your setup as well (such as the .NET Framework). Also, as you say, prompting the user will likely be confusing to them, and there will be at least some of them that choose to uninstall the redistributable package and inadvertantly remove it out from under other applications on the system that need it.

  • Anonymous
    April 28, 2008
    Thanks for the prompt response! In playing around with my install, it seems that re-installing if the package is already installed does not cause a problem. Is the preferred behavior to first check to see if it is already installed? If so, how do I determine if the package is already installed? I assume it's in the registry somewhere? Also it seems at least on my computer that having two versions installed simultaneously does not cause a problem. For example I currently have the 2005 and 2008 redistribs installed. Is this OK? Thanks for your help. Sorry if I'm getting a little off topic here... Mona

  • Anonymous
    April 28, 2008
    Hi Raboyd - Ideally, an application would first check to see if the VC redist package is already installed.  However, these packages were not designed to include an easy registry-based detection mechanism.  I outlined a way to check for the presence of them in these blog posts: http://blogs.msdn.com/astebner/archive/2007/01/16/mailbag-how-to-detect-the-presence-of-the-vc-8-0-runtime-redistributable-package.aspx http://blogs.msdn.com/astebner/archive/2007/01/24/updated-vc-8-0-runtime-redistributable-packages-are-included-in-visual-studio-2005-sp1.aspx It won't hurt anything though if you make your installer always run the VC redist installer package, even if it is already installed.  It will be smart enough to do a repair/re-install if it is already installed. Also, the VS 2005 and VS 2008 versions of the VC runtime files are designed to install and run side-by-side, so there should not be any problems installing both on the same system. Hopefully this helps!

  • Anonymous
    March 24, 2009
    The comment has been removed

  • Anonymous
    March 25, 2009
    Hi Sangeeta - I thought I had already posted something like this, but I can't find it so I think I may have forgotten.  I'll work on a post about this topic in the next couple of days.

  • Anonymous
    March 26, 2009
    The comment has been removed

  • Anonymous
    April 17, 2009
    Hi Sangeeta - I've written an updated blog post that describes how to perform a silent install of the VC++ 2008 and VC++ 2008 SP1 redistributable.  You can find that at http://blogs.msdn.com/astebner/archive/2009/03/26/9513328.aspx.

  • Anonymous
    January 17, 2010
    Hi Aaron! This method works in Visual C++ 2008 (x64)???, because full extraction and install then not working, so i see the first page of wizard of installation. Inside there are two MSI files like (install.msi and vc_red.msi) thanks.

  • Anonymous
    January 18, 2010
    Hi Thanatos83 - The command lines for the VC++ 2008 Redistributable packages are listed in the blog post at http://blogs.msdn.com/astebner/archive/2009/03/26/9513328.aspx.  Can you please give those command lines a try and see if they work for you in this scenario?  To summarize that other post: Unattended install for VC++ 2008 Redistributable (x64): vcredist_x64.exe /qb Silent install for VC++ 2008 Redistributable (x64): vcredist_x64.exe /qn

  • Anonymous
    August 10, 2010
    The comment has been removed

  • Anonymous
    August 11, 2010
    Hi G - There is a known bug in the installer for the Visual C++ 2008 redistributable files that causes it to install some files at the root of the C drive.  This is described in more detail in the knowledge base article at support.microsoft.com/.../950683, and this issue is fixed in the Visual C++ 2008 SP1 redistributable installer.

  • Anonymous
    November 23, 2010
    Here is a full example of detecting Visual C++ 2008 SP1 run-time files  (Visual C++ 9.0 run-time redistributable package) mdb-blog.blogspot.com/.../bootstrapper-package-detect-vcredist.html

  • Anonymous
    March 16, 2011
    To Scott Lawrence: I had your issue as well, but found a way around it: You could extract the contents of vcredist_x86.exe, giving you VCREDI~3.EXE. Then run VCREDI~3.EXE /q:a /c:"msiexec /i vcredist.msi /qn" The result is a nice and silent install of the the redistributable.

  • Anonymous
    April 14, 2011
    The comment has been removed

  • Anonymous
    April 15, 2011
    The comment has been removed

  • Anonymous
    April 18, 2011
    Hi Aaron, thanks, that works well. However, if I install a package build with KB2467175's vcredist it works fine; if I then install an older package (built with the previous redist - the one that most of this thread refers to) then the newer (KB2467175) redist is uninstalled automatically (I think the version numbers in the redists are wrong i.e. older redist is 8.0.59193, newer redist (KB2467175) is 8.0.51011 and the new package's programs fail with a side by side configuration error. Any ideas?

  • Anonymous
    April 19, 2011
    Hi Adrian Sheard - I haven't heard of this behavior before.  Can you post a link to where you downloaded the version that you installed that caused KB2467175 to be uninstalled so I can take a quick look?

  • Anonymous
    April 27, 2011
    Aaron, sorry for delay ... This is link for KB2467175: download.microsoft.com/.../vcredist_x86.exe This is link for 'older'  : download.microsoft.com/.../vcredist_x86.exe Adrian

  • Anonymous
    May 10, 2011
    Hi Adrian Sheard - You're right - the "older" redistributable package has a higher version number than the "newer" one, and it is configured to automatically uninstall previous version numbers.  You'll need to install the "older" one before the "newer" one to avoid this behavior.  If you get a chance, can you please also report this issue on the Connect site as well - connect.microsoft.com/visualstudio

  • Anonymous
    June 22, 2011
    The comment has been removed

  • Anonymous
    June 22, 2011
    The comment has been removed

  • Anonymous
    June 22, 2011
    The comment has been removed

  • Anonymous
    June 23, 2011
    The comment has been removed

  • Anonymous
    July 13, 2011
    Hi Aaron, Thanks for informative post. Couple of questions: 1.) Does installing this VC redist actually return valid exit code? It seems to me that it is always returning exist code 0. How can we print reurn code of running this exe in silent mode on command prompt? 2.) Is there any separate switch option of running this vcredist exe in 'repair' mode in case it is already installed on system? or using same options always and it would automatically run in 'repair' mode upon detecting it already installed on system?

  • Anonymous
    July 14, 2011
    The comment has been removed

  • Anonymous
    July 14, 2011
    I checked the %ERRORLEVEL% variable but it is always '0' even if the installtion failed. I have a system where vcredist 2008 x86 install is failing always due to some registry issues (error 1603). The MSI log also says failure, but running this vcredist_x86.exe in silent mode always return '0'. Any pointers?

  • Anonymous
    July 15, 2011
    Hi Michel - I've seen setup programs that chain in the VC++ Redistributable and they are able to correctly detect whether or not the install succeeds by examining the exit code.  I think this might just be something in how the ERRORLEVEL value is being assigned or something like that.  I'm not an expert in batch scripting, so I'm not sure what to suggest to solve this though.  Is it an option for you to install the VC++ Redistributable via a setup chainer as opposed to a batch script?

  • Anonymous
    July 26, 2011
    theres a new version. www.microsoft.com/.../details.aspx it doesn't appear to have the double wrapper so i think the comman lines from the first post should work with these: blogs.msdn.com/.../715755.aspx

  • Anonymous
    July 31, 2011
    Yes, the new installer does not has a double wrapper. So the command used for double wrapper installation does not work on some systems. The command for this should be the one used for single wrapper Exe i.e. /q:a /c:"msiexec /i vcredist.msi /qn /norestart" It's quite surprising to see that Microsoft keeps changing the format of VC 2005 redist EXE's - sometimes they are posted with double wrapper; while sometimes without the double wrapper. They shoould stick to one format!

  • Anonymous
    September 08, 2011
    Why not just unpack it with 7zip, and do a single "msiexec /i vcredist.msi" ?

  • Anonymous
    September 09, 2011
    Hi Martin - That is a valid way of installing the VC++ redistributable too.  The command lines in this blog post are intended for scenarios where a developer wants to automate the installation in a single step instead of unpacking in a separate step.

  • Anonymous
    February 24, 2015
    vcRedist_2005_sp1_x86.exe /q:a /c:"msiexec /i vcredist.msi /qb!" Works for me, shows small install status but user cannot click cancel.

  • Anonymous
    September 23, 2015
    I made a MST to solve the issue in KB927665 by adding correct path into it. Enjoy~ =================== start "" /wait vcredist_x64_2005_RTM.exe /q:a /c:"VCREDI~2.EXE /q:a /c:""msiexec /i vcredist.msi /qb! TRANSFORMS=""""%CD%vcredist_x64_2005_RTM_KB927665_Fix.mst"""" "" " timeout 1 start "" /wait vcredist_x64_2005_SP1.exe /q:a /c:"VCREDI~2.EXE /q:a /c:""msiexec /i vcredist.msi /qb! TRANSFORMS=""""%CD%vcredist_x64_2005_SP1_KB927665_Fix.mst"""" "" " timeout 1 start "" /wait vcredist_x64_2005_SP1_ATL.exe /q:a /c:"msiexec /i vcredist.msi /qb!" timeout 1 start "" /wait vcredist_x64_2005_SP1_MFC.exe /q:a /c:"msiexec /i vcredist.msi /qb!" timeout 1 pause