Microsoft Visual C++ 2008 Redist 9.0.21022 Install to C:\ROOT
Something I thought I would share because I have seen mention of this before on this and other forums. This MSI will natively extract its files to the C:\ROOT to perform the installation and not remove the files after. This is because the TARGETDIR variable was not set in the original MSI.
As best practice is to not repackage an MSI, I chose to fix this in the install command by setting TARGETDIR. Note that the directory will not be created just by specifying it in the command line. It must exist prior to use. You must also extract the vcredist_x86.exe to get to the vc_red.msi.
I set variables for all of the particulars of the install (msi/mst name, log file directory, package name, etc) in my CMD's. You can see them below as %VARIABLE%.
:: Package Variables
SET PACKAGE=%Filename:.cmd=%
SET SOURCE=%~dp0Source
SET LOGFILENAME=%PACKAGE%.LOG
SET LOGFILEDIR=%SYSTEMDRIVE%\LOGS\MS_Visual_C++_2008_Redist_9021022
:: Variable for working directory for the install files
set WRKDIR=%LOGFILEDIR%\WRKDIR
:: Creating working directory for the install files
IF NOT EXIST %WRKDIR% MD %WRKDIR%
:: Command to install the MSI
%SYSTEMROOT%\System32\msiexec.exe /i "%SOURCE%\%MSINAME%" TRANSFORMS="%SOURCE%\%MSTNAME%" TARGETDIR="%WRKDIR%" /liwear "%LOGFILEDIR%\%PACKAGE%_MSI.LOG" /qn
:: Deleting working directory for the install files
IF EXIST "%WRKDIR%" RD "%WRKDIR%" /S /Q
Hope this helps.
As best practice is to not repackage an MSI, I chose to fix this in the install command by setting TARGETDIR. Note that the directory will not be created just by specifying it in the command line. It must exist prior to use. You must also extract the vcredist_x86.exe to get to the vc_red.msi.
I set variables for all of the particulars of the install (msi/mst name, log file directory, package name, etc) in my CMD's. You can see them below as %VARIABLE%.
:: Package Variables
SET PACKAGE=%Filename:.cmd=%
SET SOURCE=%~dp0Source
SET LOGFILENAME=%PACKAGE%.LOG
SET LOGFILEDIR=%SYSTEMDRIVE%\LOGS\MS_Visual_C++_2008_Redist_9021022
:: Variable for working directory for the install files
set WRKDIR=%LOGFILEDIR%\WRKDIR
:: Creating working directory for the install files
IF NOT EXIST %WRKDIR% MD %WRKDIR%
:: Command to install the MSI
%SYSTEMROOT%\System32\msiexec.exe /i "%SOURCE%\%MSINAME%" TRANSFORMS="%SOURCE%\%MSTNAME%" TARGETDIR="%WRKDIR%" /liwear "%LOGFILEDIR%\%PACKAGE%_MSI.LOG" /qn
:: Deleting working directory for the install files
IF EXIST "%WRKDIR%" RD "%WRKDIR%" /S /Q
Hope this helps.
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
anonymous_9363
13 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.