您如何检索 Chocolatey 安装参数?

How do you retrieve Chocolatey Install Arguments?

如何检索 Chocolatey 安装参数?我知道如何获取参数:$pp = Get-PackageParameters 但不知道如何安装参数。 具体来说,我想看看是否设置了 --forceX86--x86 标志。

来自 Chocolatey Gitter 频道 Kim J. Nordmo @AdmiringWorm 的回答。

@dhoer as far as I know, there isn't a way to retrieve all the arguments, just the arguments passed with --package-args.

However, if the only thing you need is to detect if the user tries to force --x86, then you can check if the following environment variable $env:chocolateyForceX86 is equal to $true

例子

if ((Get-ProcessorBits 32) -or $env:ChocolateyForceX86 -eq $true) {}