Advertisement
J2897

Chocolatey Updating Environment Variables

Jan 20th, 2021 (edited)
1,314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.91 KB | None | 0 0
  1. @echo OFF
  2.  
  3. :: Programs installed via Chocolatey may sometimes have version numbers
  4. :: in the folder names.
  5. ::
  6. :: So the path to executables may change during auto-updates.
  7. ::
  8. :: This can set cURL and HTML Tidy as a user Environment Variable at system
  9. :: startup or after every scheduled auto-update.
  10.  
  11. pushd "%CHOCOLATEYINSTALL%\lib\curl\tools\curl*\bin"
  12. setx CURL_EXE "%CD%\curl.exe"
  13. popd
  14.  
  15. pushd "%CHOCOLATEYINSTALL%\lib\html-tidy\tools\tidy*\bin"
  16. setx TIDY_EXE "%CD%\tidy.exe"
  17. popd
  18.  
  19. REM Run this from the commandline to check the current version.
  20. :: "%CURL_EXE%" --version
  21.  
  22. REM Or you can do the same in PowerShell...
  23. :: $CurlDir = Get-ChildItem "$Env:ChocolateyInstall\lib\curl\tools\curl*\bin"
  24. :: [System.Environment]::SetEnvironmentVariable('CURL_EXE', "$CurlDir\curl.exe", [System.EnvironmentVariableTarget]::User)
  25. :: # Start-Process -FilePath "$Env:CURL_EXE" -ArgumentList "--version" -NoNewWindow -Wait
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement