我正在尝试使用 cmd 文件从 Powershell 运行 MSI 安装命令。
我创建我的安装命令:
msiexec /i [insert here a HUGE amount of param values] /lv install.log /passive
然后我将其写入 temp.cmd,然后从 Powershell 执行,如下所示:
$exitCode = (Start-Process -FilePath "temp.cmd" -Wait -Passthru).ExitCode
然后我收到以下错误消息:
CategoryInfo : OperationStopped: 255:String
RuntimeException FullyQualifiedErrorId
Failed to install [Msi Name] MsiExec returned: 255
是什么原因造成的?
最佳答案
如果您尝试从命令行运行我遇到问题的 MsiExec 命令,我会收到以下错误消息:
The input line is too long
在 Powershell 中执行时,此错误并不明显,您可能会认为这是 MsiExec 的问题。
这是一条有点神秘的错误消息,与命令行总长度为 8191 的 cmd.exe 有关。
请参阅有关 cmd 长度的 Microsoft 知识库文章:http://support.microsoft.com/kb/830473
关于powershell - 从 Powershell 运行 cmd 文件时,无法安装 [名称] MsiExec 返回 : 255,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11967819/