[英]Powershell Script - Install file.exe silently
我试图用 Powershell 静默安装一个可执行文件,尽管它不起作用,但它是徒劳的。 有很多关于这个问题的回答,但不幸的是,它们都不适合我。
这些是我迄今为止尝试过的方法:
Start-Process -Wait -FilePath ".\OCS-DistributionService.exe" -ArgumentList '/S','/v','/qn' -PassThru (error about empty ArgumentList)
Start-Process .\OCS-DistributionService.exe /S -NoNewWindow -Wait -PassThru (nothing happens - screenshotbelow)
Start-Process -FilePath ".\OCS-DistributionService.exe" -Verb runAs -ArgumentList '/s','/v"/qn"' (nothing happens)
Start-Process -FilePath ".\OCS-DistributionService.exe /S /NoPostReboot _?=.\OCS- DistributionService.exe" -NoNewWindow -Wait -PassThru $process.ExitCode (error about empty ArgumentList)
& .\OCS-IdentityProvider.exe /s /v"/qn" (it works BUT it is not silent, I need to click Next, ..., Install...)
& ".\OCS-DistributionService.exe" | Out-Null (it works BUT it is not silent, I need to click Next, ..., Install...)
我在这里错过了什么吗? 我是 Powershell 脚本的新手,我只是想为新的初学者创建一个自动化脚本,这是其中的步骤之一。
再次感谢任何帮助 :)
谢谢大家,根据@js2010 的建议,我已经设法使用单独的 .bat 文件完成了我需要的工作:) 在我的 ps 脚本中,我将新创建的文件称为:
& "./install_my_services.bat" | Out-Null
bat 文件看起来像这样:
Start /wait "" ".\OCS-DistributionService.exe" -i /silent
它会根据需要进行静默安装。
再次感谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.