批处理脚本安装MSI [英] Batch script to install MSI

查看:383
本文介绍了批处理脚本安装MSI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图写一个蝙蝠首次。

我试图安装的.msi使用脚本,我们目前正在手动通过双击它进行安装。

I am trying to install .msi using script, currently we are installing manually by double clicking on it.

从路径 D:/安装SW / $文件夹/的.msi

路径 D:/ Program Files文件/程序/

$文件夹表示,它是不同的每一次,因为我们得到新的MSI安装这是由当前日期创建的文件夹提供。

$folder means, it is different every time, as we are getting new msi to install which are provided in folder created by current date.

下面是我想的脚本:

@echo off
Title HOST: Installing Updates on %computername%
echo %computername%
set server=\\SERVERNAME or PATH\msifolder
:select
cls
echo Select one of the Following MSI Install Folders for installation task.
echo.
dir %server% /A:D /B
SET /P MSI=Please enter the MSI Folder to install: 
SET source=%server%\%MSI%
echo Selected Installation %MSI%
echo.
echo.

:verify
ECHO Is This Correct?
echo.
echo.
ECHO 0: ABORT INSTALL
ECHO 1: YES
ECHO 2: NO,RE-SELECT
SET /p choice=Select YES, NO or ABORT? [0,1,2]:
     if /i [%choice%]==[0] endlocal&goto end
     if [%choice%]==[] goto BCurrentlocal
     if [%choice%]==[1] goto yes
 if [%choice%]==[2] goto no
 endlocal

:no
goto select
:yes
set FILENAME=%MSI%
call %source%\%FILENAME%.msi
echo beginning %MSI% installation
pause
echo Exiting Install Script....
PING -n 4 127.0.0.1 >nul
exit

在与组服务器行我加入的路径

SET / p MSI 是从的路径

但是,它不工作。

任何人都可以指导我我在做什么错误?

Can anyone guide me what mistake I am doing?

推荐答案

这是如何安装一个正常的MSI文件默默

msiexec.exe /i c:\setup.msi /QN /L*V "C:\Temp\msilog.log"

快速的解释:

 /L*V "C:\Temp\msilog.log"= verbose logging
 /QN = run completely silently
 /i = run install sequence 

msiexec.exe的命令行 广泛与各种选项的支持。这里是同一个命令行界面的另一个概述。这里是href=\"http://technet.microsoft.com/en-us/library/cc759262(v=ws.10).aspx\" rel=\"nofollow\">注解版本的的

The msiexec.exe command line is extensive with support for a variety of options. Here is another overview of the same command line interface. Here is an annotated versions.

也可以为制作一个批处理文件短得多与构造,如 作为循环如左图所示Windows更新

It is also possible to make a batch file a lot shorter with constructs such as for loops as illustrated here for Windows Updates.

如果有复选框,必须在安装过程中进行检查,你必须找到合适的的公共属性 连接到复选框,并在这样的命令行设置:

If there are check boxes that must be checked during the setup, you must find the appropriate PUBLIC PROPERTIES attached to the check box and set it at the command line like this:

msiexec.exe /i c:\setup.msi /QN /L*V "C:\Temp\msilog.log" STARTAPP=1 SHOWHELP=Yes

这些属性中的每个MSI不同。您可以通过在详细的日志文件中找到它们或<一打开MSI href=\"http://stackoverflow.com/questions/1544292/what-installation-product-to-use-installshield-wix-wise-advanced-installer/1546941#1546941\">Orca,或其他适当的工具。你必须寻找或者在对话框控制部分或属性表的属性名称是什么。尝试运行安装程序,并首先创建一个详细的日志文件,然后搜索日志ALA消息设置属性...,然后看到属性名称是那里。然后从日志文件到命令行的值添加该属性。

These properties are different in each MSI. You can find them via the verbose log file or by opening the MSI in Orca, or another appropriate tool. You must look either in the dialog control section or in the Property table for what the property name is. Try running the setup and create a verbose log file first and then search the log for messages ala "Setting property..." and then see what the property name is there. Then add this property with the value from the log file to the command line.

也看看如何使用转换自定义MSI超出设定的命令行参数:<一href=\"http://stackoverflow.com/questions/458857/how-to-make-better-use-of-msi-files/1055861#1055861\">How为更好地利用MSI文件

Also have a look at how to use transforms to customize the MSI beyond setting command line parameters: How to make better use of MSI files

这篇关于批处理脚本安装MSI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆