Installing Visual C++ Redistributable Package from Command Line

May 2015

Installing Visual C++ Redistributable Package from Command Line

You may think that unless you explicitly use some external library (like FMOD), your program will not require any additional libraries to work, but when coding in C++ using Visual Studio, this is not the case. The functions of standard C/C++ library are implemented in a package of DLL-s called Microsoft Visual C++ Redistributable Package. Each version of Visual Studio has their own set. For example, version for Visual Studio 2013 (Release configuration) consists of files: msvcr120.dll, msvcp120.dll.

You can make your application not requiring this library by setting your project options in Configuration Properties > C/C++ > Code Generation > Runtime Library to "Multi-threaded [Debug]" without the "DLL" part, which makes it statically linked. Alternatively, you can distribute these DLL files (although I'm not sure if this is legal) or the whole library installer together with your application. The library is small and free, available to download from Microsoft website:

The question is: can you launch the installer of these packages with some special parameter so the user doesn't have to go through all the setup wizard, confirming each step? The answer is yes, but as Microsoft likes to change everything very often :) the exact command line is different depending on version. Here is the whole set:

Visual Studio 2005:

Visual Studio 2005, x86 (32-bit version):
vcredist_x86.exe /q:a /c:"VCREDI~1.EXE /q:a /c:""msiexec /i vcredist.msi /qn""
Visual Studio 2005, x64 (64-bit version):
vcredist_x64.exe /q:a /c:"VCREDI~2.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "
Visual Studio 2005 SP1, x86:
vcredist_x86.exe /q:a /c:"VCREDI~3.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "
Visual Studio 2005 SP1, x64:
vcredist_x64.exe /q:a /c:"VCREDI~2.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "

If you would like to install it 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". Unattended mode + disabled "Cancel" button is "/qb!".

Visual Studio 2008: Just pass one of these parameters:

/q - quiet mode, no user interface.
/qb - unattended mode, shows progress bar but no user interaction required.
/qb! - unattended mode with "Cancel" button disabled.

Visual Studio 2010 and 2012:

/q /norestart - quiet mode
/passive /norestart - passive (unattended) mode

Visual Studio 2013, 2015, 2017:

/install /quiet /norestart - quiet mode
/install /passive /norestart - passive (unattended) mode

To quickly install all of these libraries on the machines where lots of different applications are launched that may require them, I gathered all the libraries in one directory and I have written following BAT script:

"2005 SP1\vcredist_x86.exe" /q:a /c:"VCREDI~3.EXE /q:a /c:""msiexec /i vcredist.msi /qb"" "
"2005 SP1\vcredist_x64.exe" /q:a /c:"VCREDI~2.EXE /q:a /c:""msiexec /i vcredist.msi /qb"" "

"2008 SP1\vcredist_x86.exe" /qb
"2008 SP1\vcredist_x64.exe" /qb

"2010 SP1\vcredist_x86.exe" /passive /norestart
"2010 SP1\vcredist_x64.exe" /passive /norestart

"2012 Update 4\vcredist_x86.exe" /passive /norestart
"2012 Update 4\vcredist_x64.exe" /passive /norestart

"2013\vcredist_x86.exe" /install /passive /norestart
"2013\vcredist_x64.exe" /install /passive /norestart "2015 Update 3\vc_redist.x86.exe" /install /passive /norestart "2015 Update 3\vc_redist.x64.exe" /install /passive /norestart "2017\vc_redist.x86.exe" /install /passive /norestart "2017\vc_redist.x64.exe" /install /passive /norestart

Update: I also prepared a full package with my script and "pirated" copy of all these installers for your convenience: Microsoft Visual C++ Redistributable (77.9 MB).

Comments (20) | Tags: visual studio c++ | Author: Adam Sawicki | Share


2015-11-16 17:53:49
SCCM Surfer
2016-01-05 19:47:33
Hello Adam,

This is great find. I needed to add the latest Visual C++ runtimes to a reference machine for capturing . A wonderful time saver. All I added to the batch file was this syntax -> %~dp0 in front of each line.

Thank you very much.
2016-02-05 13:22:29
This is eminently useful. I wonder if there's a way of putting together a similar batch that uninstalls all the same vcredist packages, so you can have a clean install of them?
2016-02-23 06:42:32
For the 2005 and the 2008 /Q is enough (check yourself launching the exe /?).

Thanks for the idea, I made my own bat. ;-)

PS : you can also add dxsetup in case of :
dxsetup.exe /silent
Mr. Tapz
2016-02-26 04:15:43
Thank you for this. Appreciated your work.
this is what I've been looking for.
2016-06-07 09:49:46
Seems that the file has been deleted T_T And I was so looking forward to getting your version which is better than microsoft's buggy distribution installer. As I've disabled microsoft's updates, I've been having some problems with installing packages from their installers. If you could re-upload the file with your script that would be a life saver :D Keep up the good work and good luck in all you endeavors.
2016-06-08 23:33:15
Will: Thank you for your information. I had removed the file by accident. Now I updated the link to make it work again.
2016-06-17 04:00:50
How can I force a silent repair of 2015 Update 1?

I want to silently install if not already installed, but also force a silent repair if the same installed version is corrupted.
2016-09-16 22:40:27
2016-10-05 13:39:50
Thank you for this. It was very useful. Appreciate you making the time and effort.
2016-11-08 15:53:36
I think at least for the 2015 part the name shall be vcredist_86.exe and not vc_redist.86.exe but good information on this page.
2016-11-09 16:22:55
No, the valid name of the files I downloaded, for 2015 Update 3, is really "vc_redist.x86.exe" and "vc_redist.x64.exe".
2016-12-09 09:05:44
A BIG thank you Adam!
2017-04-28 19:55:59
Thank you very much for such handy references.

Adobe just did something to their Genuine Software checker service thing that suddenly requires Visual C++ 2015 libraries on all of my computers that have Acrobat..

Friggin Adobe.
2017-05-30 13:11:16
vcredist 2017
2017-05-31 00:13:24
SerG: Thanks a lot! I updated this post and archive with 2018 version.
2017-05-31 17:26:20
Thank you very much. Very usefull parameters!
2017-06-01 19:49:41
Thank you.
2017-06-14 08:28:08
(^-^)b good job!
2017-06-25 11:48:52
This is actually so useful! Tyvm for your work =)

Post comment

Nick *
Your name or nickname
Your contact information (optional, will not be shown)
Text *
Content of your comment
Calculate *
(* - required field)
STAT NO AD [Stat] [Admin] [STAT NO AD] [pub] [Mirror] Copyright © 2004-2017 Adam Sawicki
Copyright © 2004-2017 Adam Sawicki