0

我正在尝试安装一个相当陈旧的应用程序。我想在 powershell 中执行此操作,因为我有需要在 powershell 中完成的安装后功能 -argumentlist 没有在 /qn 之后启动所有参数(静默模式安装)

应用程序启动并继续以静默模式无人参与安装,但忽略 /qn 之后的所有参数。所以它的安装没有我指定的任何参数。有什么我做错了吗?可能只是我的报价在错误的地方。我的powershell知识非常生疏

$workingDirectory = (split-path $myinvocation.mycommand.path -parent)

#Installs my application
Start-Process -Filepath "$workingDirectory\application.exe" -ArgumentList "/args /qn reboot=reallysuppress SILENT=yes INSTALLSTANDALONE=0 CENTRALSERVERHOSTNAME=servername CENTRALSERVERPORT=1234 CSUSER=userName /L*V C:\Windows\Temp\install.log" 
4

2 回答 2

0

我假设您直接使用这些参数运行 .EXE 以验证它们的正确性?

如果是这种情况,试试这个:

Start-Process -Filepath "$workingDirectory\application.exe" -ArgumentList "/args", "/qn", "reboot=reallysuppress", "SILENT=yes", "INSTALLSTANDALONE=0", "CENTRALSERVERHOSTNAME=servername", "CENTRALSERVERPORT=1234", "CSUSER=userName", "/L*V", "C:\Windows\Temp\install.log" 

或这个:

Start-Process -Filepath "$workingDirectory\application.exe" -ArgumentList @("/args", "/qn", "reboot=reallysuppress", "SILENT=yes", "INSTALLSTANDALONE=0", "CENTRALSERVERHOSTNAME=servername", "CENTRALSERVERPORT=1234", "CSUSER=userName", "/L*V", "C:\Windows\Temp\install.log")

或这个:

& "$workingDirectory\application.exe" /args /qn reboot=reallysuppress SILENT=yes INSTALLSTANDALONE=0 CENTRALSERVERHOSTNAME=servername CENTRALSERVERPORT=1234 CSUSER=userName /L*V C:\Windows\Temp\install.log 

或者,当您删除/qnarg 时会发生什么?

于 2020-06-26T12:24:55.803 回答
0

我遇到了类似的问题。

改变了这个:

& "$workingDirectory\application.exe" /args /qn reboot=reallysuppress SILENT=yes INSTALLSTANDALONE=0 CENTRALSERVERHOSTNAME=servername CENTRALSERVERPORT=1234 CSUSER=userName /L*V C:\Windows\Temp\install.log 

对此:

& "$workingDirectory\application.exe" /qn reboot=reallysuppress SILENT=yes INSTALLSTANDALONE=0 CENTRALSERVERHOSTNAME=servername CENTRALSERVERPORT=1234 CSUSER=userName /L*V C:\Windows\Temp\install.log 

来源:https ://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx

于 2021-04-30T14:39:07.397 回答