[[PackageName]] vs $env:ChocolateyPackageName #2702
-
It seems like I can use both [[PackageName]] and $env:ChocolateyPackageName within a chocolatey template. Which is preferred? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It depends on what you are using it for in the script. Either would work in almost all cases.
|
Beta Was this translation helpful? Give feedback.
It depends on what you are using it for in the script. Either would work in almost all cases.
$env:ChocolateyPackageName
is slightly better in my option for most uses, as if the package needs its ID changed in the future (e.g. moving it to a.install
package), then that is one less hardcoded thing to change. But[[PackageName]]
would be useful if it is used for say an install directory name, that would probably not want to change if the package ID needed to be updated.