powershell - 从 Powershell 运行 cmd 文件时,无法安装 [名称] MsiExec 返回 : 255,

标签 powershell windows-installer

我正在尝试使用 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/

相关文章:

azure-devops - Azure Devops Pipeline - 使用 Microsoft Visual Studio 安装程序项目

visual-studio - WIX 3.5 Visual Studio 项目为已安装文件的 .NET 版本创建多个 MSI

wix - 如何在不重新启动任何组件的情况下强制安装 MSI - 而是强制重新启动

wix - 微星 : Upgrading 32-Bit application to 64-Bit

wix - Installshield 是否遵循 RFC 4122 规范来生成组件 GUID?

date - 比较没有时间的日期

azure - 如何删除 Azure 中的 SQL 数据库?

powershell - 获取非 "common parameters"的绑定(bind)参数?

iis - 使用PowerShell从IIS导出证书

powershell - PowerShell管道添加换行