Skip to content

Instantly share code, notes, and snippets.

@AdmiringWorm
Last active April 3, 2022 18:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdmiringWorm/923b8cf063840abf06f514b9fbc5197c to your computer and use it in GitHub Desktop.
Save AdmiringWorm/923b8cf063840abf06f514b9fbc5197c to your computer and use it in GitHub Desktop.
Environment variables set when powershell script is running through choco

Environment variables set when powershell script is running through choco

NOTE: All of the following variables need to be prefixed with $env:

  • CHOCOLATEY_VERSION: 0.10.3.0
  • CHOCOLATEY_VERSION_PRODUCT: 0.10.3 (EXPERIMENTAL)
  • ChocolateyForce - $true if the user passed --force when installing, otherwise not set
  • ChocolateyInstall - Set to the path where choco is installed.
  • chocolateyInstallArguments - The extra arguments the user have passed to the installer (EXPERIMENTAL)
  • chocolateyInstallOverride - $true if the user passed --notsilent (EXPERIMENTAL)
  • ChocolateyPackageFolder - The path to where the package content is cached
  • chocolateyPackageParameters - All parameters the user passed using the --params argument
  • ChocoPackageName - The ID of the installing package
  • ChocoPackageTitle - The Title of the installing package
  • ChocoPackageVersion - The Version of the installing package
  • chocolateyForceX86 - $true if the user passed --x86 when installing, otherwise not set
  • packageFolder - The path to where the package content is cached
  • packageName - The ID of the installing package
  • packageTitle - The Title of the installing package
  • packageVersion - The Version of the installing package
  • TEMP - The path to chocolateys temporary cache directory
  • TMP - The path to chocolateys temporary cache directory
  • OS_PLATFORM - The current platform the user is running (i.e. Windows, OSX, Linux)
  • OS_VERSION - The current version of the platform the user is running
  • OS_NAME - The reported name of the Operating System.
  • IS_PRCESSELEVATED - Are we currently running with elevated privileges
  • OS_IS64BIT - Are we running on a 64 bit operating system (EXPERIMENTAL)
  • IS_ADMIN - Is the current user an administrator (EXPERIMENTAL)

DISCLAIMER: This gist is just meant to show what variables is available in choco v 0.10.3, it's YOUR responsibility to make sure they are available in earlier versions and that they are allowed to use on chocolatey.org (if the package will be submitted there).

@AdmiringWorm
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment