Question

How can I find a batch file using a version of Windows installer?

for example:

For /F %%A In ('reg query "HKEY_LOCAL_MACHINE..."') do Echo Windows Installer v3.1 found
For /F %%A In ('reg query "HKEY_LOCAL_MACHINE..."') do Echo Windows Installer v4.0 found
For /F %%A In ('reg query "HKEY_LOCAL_MACHINE..."') do Echo Windows Installer v4.5 found

What registry keys should I use?

Was it helpful?

Solution

Are you talking about msiexec.exe ?

; @echo off
;call :fileinf /l "%windir%\System32\msiexec.exe"
; echo   windows installer version %vern%
;pause
;goto :eof
;:fileinf
;;setlocal DISABLEDELAYEDEXPANSION ENABLEEXTENSIONS
;;goto :end_help
;;;
;;;
;;; fileinf /l list of full file paths separated with ; (if file is more than one enclose all of them in double quotes)
;;; fileinf /f text file with a list of files to be processed ( one on each line )
;;; fileinf /? prints the help
;;;
;;:end_help

; REM Creating a Newline variable (the two blank lines are required!)
; set NLM=^


; set NL=^^^%NLM%%NLM%^%NLM%%NLM%
; if "%~1" equ "/?" type "%~f0" | find ";;;" | find /v "find" && exit /b 0
; if "%~2" equ "" type "%~f0" | find ";;;" | find /v "find" && exit /b 0
; setlocal enableDelayedExpansion
; if "%~1" equ "/l" (
;  set "_files=%~2"
;  echo !_files:;=%NL%!>"%TEMP%\file.paths"
;  set _process_file="%TEMP%\file.paths"
;  goto :get_info
; )

; if "%~1" equ "/f" if exist "%~2" (
;  set _process_file="%~2"
;  goto :get_info
; )

; echo incorect parameters & exit /b 1
; :get_info
; set "file_info="

; makecab /d InfFileName=%TEMP%\file.inf /d "DiskDirectory1=%TEMP%" /f "%~f0"  /f %_process_file% /v0 >nul 2>&1

; for /f "usebackq skip=4 delims=" %%f in ("%TEMP%\file.inf") do (
;  set "line=%%f" 
;  set "line=!line::==!"
;  set "file_info=!line!"
; )


;for %%v in ("%file_info%") do (set %%~v)

;endlocal& set "vern=%vern%"
;endlocal& set "vern=%vern%"
; del /q /f %TEMP%\file.inf 2>nul
; del /q /f %TEMP%\file.path 2>nul
; exit /b 0

.set DoNotCopyFiles=on
.set DestinationDir=;
.set RptFileName=nul
.set InfFooter=;
.set InfHeader=;
.Set ChecksumWidth=8
.Set InfDiskLineFormat=;
.Set Cabinet=off
.Set Compress=off
.Set GenerateInf=ON
.Set InfDiskHeader=;
.Set InfFileHeader=;
.set InfCabinetHeader=;
.Set InfFileLineFormat="vern:*ver*"

OR

WMIC DATAFILE WHERE name="C:\\Windows\\System32\\msiexec.exe" get Version /format:Textvaluelist

OTHER TIPS

It sounds like you are trying to make a bootstrapper / chainer. .BAT is not appropriate for that task. You should look at Windows Installer XML (WiX) "Burn" bootstrapper. You can use this to create an EXE that will chain together your MSI and .NET prereqs before installing your MSI.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top