Having trouble setting automatically set PATH to programFiles\veyon after installation. I would like to use the veyon-ctl command line with out having to manually link it.
-
What exactly is the problem that you are having? – Gary Ewan Park Oct 25 '18 at 21:25
-
I can't figure how to get chocolatey to set the environment variable path to the C:/Program Files/Veyon. It works when I do it manually, but I would like to have chocolate do it for me – Gibson Oct 26 '18 at 21:41
1 Answers
The code that you have highlighted seems to be working exactly as expected. I have just taken that code, and added it to a package and installed it. The result was the following...
As you will see mentioned in the output, this environment variable will not be available in the current shell until you open/close the shell. I suspect that this is the problem that you are running into.
Chocolatey does provide a helper function called refreshenv
which would allow you to force the reloading of the environment variables into the current shell, however, this isn't enabled by default. You can find out how to do this by reading the article here:
https://chocolatey.org/docs/troubleshooting#i-cant-get-the-powershell-tab-completion-working
But what it comes down to is that you need to load the following into your PowerShell Profile:
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
Once this is loaded, after seeing output similar to the following when installing a Chocolatey package, you can execute the command refreshenv
and the new environment variables will be available in the current shell.

- 17,610
- 5
- 42
- 60