Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
647 views
in Technique[技术] by (71.8m points)

batch file - Issue installing MSI silently using msiexec, possible syntax issue?

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%DownloadsmysqlODBC.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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 "\ServerShareSetup.msi" /QN /L*V "C:Tempmsilog.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 "\ServerShare\%username%Setup.msi" /QN /L*V "C:Tempmsilog.log"

Quick Parameter Explanation:

 /i = run install sequence 
 /QN = run completely silently
 /L*V "C:Tempmsilog.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:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...