Issue installing MSI silently using msiexec, possible syntax issue?

我们两清 提交于 2019-12-13 01:54:01

问题


Essentially I would like to install an msi file silently, and I've got it to work using the following line:

msiexec /i C:\Users\%username%\Downloads\mysqlODBC.msi /passive

One addition I would like to make is to add double quotes to the user name portion of the line to ensure any usernames that may contain spaces are read correctly. ----> "%username%"

The issue is the msi file fails to install when I add this. I have always used this when writing batch scripts with directories. Any idea how this can be addressed to work with msiexec?

Link to MSI file I am trying to quietly install:

https://dev.mysql.com/downloads/file/?id=484649


回答1:


Network Installation Point?: It is not quite clear to me what you are trying to achieve. Do you want to automate the installation of this MSI on many machines? If so you should create a network installation point accessible via a UNC path and run an administrative image to extract all files and create a network installation point that can be used for all computers:

msiexec.exe /i "\\Server\Share\Setup.msi" /QN /L*V "C:\Temp\msilog.log"

If you have that instillation point there really is no reason to make a folder for each user. Why duplicate installation files? Surely you don't want each user to download the installer? You would want to download once, malware check and then rely on what you downloaded once and for all?

Anyway, if you insist:

msiexec.exe /i "\\Server\Share\%username%\Setup.msi" /QN /L*V "C:\Temp\msilog.log"

Quick Parameter Explanation:

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

msiexec.exe: See this answer for some further details on the msiexec.exe command line: MSIEXEC what is the difference between qn and quiet. There are two different flavors of it - two different sets of switches: old style and some newer, "friendlier" versions. I only use the old style switches. There is a tool you can use to generate the command lines.


Some Links:

  • Customize msiexec progress bar?
  • How to install an MSI silently



回答2:


TL; DR :

pushd "C:\Users\%username%\Downloads\"
msiexec.exe /a "mysqlODBC.msi" /quiet /norestart /log "%cd%\msiexec_install.log"
popd

Details :

While the fully qualified path should be able to placed in-between double-quotes, an alternative option would be to use pushd and popd to move to an from the directory containing the MSI.

In the example above, I replaced the progress bar (aka /passive) with /quiet. I also used /a rather than /i out of habit - either can be used to install. And I included a log-to-file option which can be useful in troubleshooting.



来源:https://stackoverflow.com/questions/55463602/issue-installing-msi-silently-using-msiexec-possible-syntax-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!