[英]Chocolatey package creation: How to select a language for a silent installation
While creating a package for chocolatey , the installation fails because the installer asks for a language selection: Window asking for the user's language for installation .在为chocolatey创建 package 时,安装失败,因为安装程序要求选择语言: Window 要求用户的安装语言。
So I tried, as explained in this page to get the user's language ( get-culture
) and add it in the installation arguments by calling the variable ( $locale
):因此,我尝试按照本页中的说明获取用户的语言 ( get-culture
) 并通过调用变量 ( $locale
) 将其添加到安装 arguments 中:
$ErrorActionPreference = 'Stop';
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$locale = "/L=" + (Get-Culture).LCID
$packageArgs = @{
packageName = 'PNAME'
unzipLocation = $toolsDir
file = "PNAME32bit.exe"
file64 = "PNAME64bit.exe"
fileType = 'EXE'
silentArgs = '/S $locale'
softwareName = 'PNAME*'
validExitCodes= @(0)
}
Install-ChocolateyInstallPackage @packageArgs
Remove-Item $toolsDir\*.exe -ea 0 -force
Unfortunately, no change, this window still appears.不幸的是,没有变化,这个 window 仍然出现。
My question is therefore: how to specify during installation, the user's language so that this is taken into account by the installer?因此,我的问题是:如何在安装过程中指定用户的语言,以便安装程序考虑到这一点?
Thank you in advance for your help !预先感谢您的帮助 !
If the installer does not allow you to specify the language at the time of installation then you have two options:如果安装程序不允许您在安装时指定语言,那么您有两个选择:
The first one is relatively trivial to do but can be a little messy (Autohotkey would run in the background, detect the window, click the right language etc.).第一个相对简单,但可能有点混乱(Autohotkey 会在后台运行,检测 window,单击正确的语言等)。 It may also get messy when you have to start 'clicking' the correct language.当您必须开始“单击”正确的语言时,它也可能变得混乱。 The second one would be the preferred method as it's less messy but would require some time working with the installer.第二种是首选方法,因为它不那么混乱,但需要一些时间与安装程序一起工作。
The ideal solution is of course to either find the correct parameter to pass to the installer OR get the vendor to add such a parameter.理想的解决方案当然是要么找到正确的参数传递给安装程序,要么让供应商添加这样的参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.