DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

10x learner
10x learner

Posted on • Originally published at 10xlearner.com on

How to add a program to the system path in a Chocolatey package

Hello ! I’m Xavier Jouvenot and in this small post, we are going to see how to add a program to the system path in a Chocolatey package.

Self promotion: You can find other articles on my website πŸ˜‰

Problematic

When creating a Chocolatey package, you may end up installing a program either in a totally different place than chocolatey packages binary folder, or excluding the executables you want to install from getting shims. In such case, the program installed may not be directly accessible via the command line as it will not be present in one path included in the PATH variable of the system.

Solution

To correct this problem, all you have to do is to include one of the two following lines:

Install-ChocolateyPath -PathToInstall "C:\actual\path\to\the\executable" -PathType User
# or, if the executable is getting shims are installed in the same place of the install script
Install-ChocolateyPath -PathToInstall $PSScriptRoot -PathType User
Enter fullscreen mode Exit fullscreen mode

Pretty easy solution isn’t it ? You only need to know where your program is getting installed and everything will work fine πŸ˜‰


Thank you all for reading this article, And until my next article, have a splendid day πŸ˜‰

Interesting links

Top comments (0)

Join us at DEV You’ve already scrolled down this far, why not join our community of 900k+ developers all learning together?