0

如何使用某个版本的 Windows 安装程序找到批处理文件?

例如:

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

我应该使用哪些注册表项?

4

2 回答 2

1

你在谈论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*"

或者

WMIC DATAFILE WHERE name="C:\\Windows\\System32\\msiexec.exe" get Version /format:Textvaluelist
于 2013-12-12T07:20:28.980 回答
1

听起来您正在尝试制作引导程序/链接器。.BAT 不适用于该任务。您应该查看 Windows Installer XML (WiX)“Burn”引导程序。您可以使用它来创建一个 EXE,在安装 MSI 之前将您的 MSI 和 .NET prereqs 链接在一起。

于 2013-12-12T14:23:47.223 回答