Search code examples
chocolatey

How do you retrieve Chocolatey Install Arguments?


How do you retrieve Chocolatey Install Arguments? I know how to get params: $pp = Get-PackageParameters but not install args. Specifically, I want to see if --forceX86 or --x86 flags are set.


Solution

  • Answer from Kim J. Nordmo @AdmiringWorm in Chocolatey Gitter Channel.

    @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

    Example

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