To permanently set Windows environment variables (e.g. PATH) from a (PowerShell) script, you can use setx or Set-ItemProperty like this (for the current user):
setx VARIABLE value Set-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Environment' -Name VARIABLE -Value "value"
And here is the result:
THANKS FOR SHARE