Microsoft 安装程序命令行字符串参数不起作用? [英] Microsoft Installer command line string parameter not working?

查看:25
本文介绍了Microsoft 安装程序命令行字符串参数不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试图用我的 msi 运行一个完全安装,似乎我可以轻松地为我拥有的参数传递一个数字,但我似乎无法传递一个字符串......我试过了使用单引号 ' 和双引号 "

So I am trying to run a quite installation, with my msi, and it seems like I can easily pass a number for a parameter that I have, but I can't seem to pass in a string...I tried using single quotes ' and double quotes "

msiexec /i 'My Installer.msi' /quiet JREPATH="c:\\BLA BLA"

这个和单引号返回这个:

This and also the single quotes return this :

现在根据这篇文章:https://docs.microsoft.com/en-us/windows/desktop/msi/command-line-options

它应该可以工作...

文字字符串的属性值必须用引号括起来分数.在标记之间的字符串中包含任何空格.

Property values that are literal strings must be enclosed in quotation marks. Include any white spaces in the string between the marks.

msiexec/i A:\Example.msi PROPERTY="Embedded White Space"

msiexec /i A:\Example.msi PROPERTY="Embedded White Space"

MSI 没有问题,我认为这是因为如果我传递一个数字..它工作...

There is no problem with the MSI, I assume this because if i pass a number..it works...

msiexec /i 'My Installer.msi' /quiet JREPATH=3

后期

当我在参数值中有一个空格时,问题似乎出现了..例如像下面的例子一样工作:

It seems that the problem appears when I have a space in the value of the parameter..for example something like the example below works :

msiexec /i "WKFS ReportGenerator.msi" /quiet JREPATH="c:\\;;BLA"

但这不会:

msiexec /i "WKFS ReportGenerator.msi" /quiet JREPATH="c:\\;;BLA a"

后期编辑 2:

如果使用简单的 cmd 而不是 PowerShell,这些命令在值中包含空格工作..

These commands including spaces in the value work if using a simple cmd instead of PowerShell..

推荐答案

如果从 Powershell 调用,则应使用调用运算符 &这应该也适用于用引号括起来的参数:

If you invoke from Powershell, you should use the call operator & This should then also work with parameters enclosed in quotes:

& msiexec /i `"My Installer.msi`" /quiet JREPATH=`"c:\BLA BLA`"

这篇关于Microsoft 安装程序命令行字符串参数不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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