【发布时间】:2022-01-18 02:00:51
【问题描述】:
我正在为无人值守安装推出一个脚本,我为 Office 2019 安装构建了一个小型 .bat,当我运行它时它运行良好,但是当我通过 PowerShell 脚本调用它时,安装不运行。
有什么想法吗?
这是部分代码
Invoke-Command -ScriptBlock {Start-Process -FilePath "c:\temp\Office2019\Install-32.bat" -ArgumentList "--quiet" -Verb RunAs -Wait}
.bat 文件
setup.exe /configure configuration-x86.xml
Office 配置文件
<Add OfficeClientEdition="32">
<Product ID="ProPlus2019Volume" PIDKEY="MYKEY">
<Language ID="en-us" />
</Product>
</Add>
<Display Level="None" AcceptEULA="TRUE"/>
<Property Name="AUTOACTIVATE" Value="1"/>
</Configuration>
非常感谢您的建议。
【问题讨论】:
-
我认为您不能使用参数列表来调用 bat 文件。您必须在 bat 文件本身中指定进行静默安装。或者您可以直接调用
setup.exe -argumentlist “/configure $xmlfile /q” -wait,而不是使用 bat 文件
标签: powershell batch-file