在静默安装过程中如何更改EXE文件的目标目录/安装路径

时间:2020-09-14 15:48:25

标签: python-3.x powershell automation silent-installer cab

我正在尝试静默安装exe软件,同时在安装过程中更改目标目录

我无法在安装期间更改路径/目录。

我知道可用于exe文件的开关,我已经为尝试安装的exe附加了相同的开关,但似乎无法使用 编辑 高级安装程序>> (Microsoft CAB自解压存档)

命令开关: / extract:path; / log [:path]; / lang:lcid; / quiet; / passive; / norestart; / forcerestat

我尝试过的各种命令/块: Python

p = subprocess.Popen(r'path\file.exe /quiet /v"INSTALLDIR=\"path""', shell=True)
p = subprocess.Popen(r'path\file.exe /quiet TARGETDIR="path""')

我在 powershell 时遇到了同样的问题。

感谢您的帮助。 enter image description here

3 个答案:

答案 0 :(得分:3)

注意:此答案不能解决em的问题,但它应适用于基于 MSI (基于Windows Installer)的安装程序可执行文件使用高级安装程序创建的。


The Advanced Installer documentation表示APPDIR是属性的名称,对于基于MSI的可执行文件,您可以在命令行中对其进行覆盖(未调试):

Python:

p = subprocess.Popen(r'path\file.exe /quiet APPDIR="path"', shell=True)

PowerShell,假设您要等待安装完成:

Start-Process -Wait 'path\file.exe' '/quiet APPDIR="path"'

答案 1 :(得分:0)

根据产品所使用的安装程序软件提供开关。例如,可以通过Powershell通过这种方式向Puppet安装程序exe传递参数-您可以在安装程序中使用此语法。

            Start-Process -FilePath C:\temp\puppet-agent-x64-latest.msi -ArgumentList "/qn /norestart -L* c:\temp\mylog.txt" -wait

答案 2 :(得分:0)

似乎有任何可用于 AccessDatabaseEngine_X64.exe 的目标/路径, 我发现的唯一解决方法是使用 /extractexe 中获取 msi 然后使用 @mklement0建议。