J2897 icon

Chocolatey Updating Environment Variables

J2897 | PRO | 02/14/21 01:53:24 PM UTC (Edited) | 0 ⭐ | 1945 👁️ | Never ⏰ | []
Batch |

910 B

|

None

|

0 👍

/

0 👎

@echo OFF
 
:: Programs installed via Chocolatey may sometimes have version numbers
:: in the folder names.
::
:: So the path to executables may change during auto-updates.
::
:: This can set cURL and HTML Tidy as a user Environment Variable at system
:: startup or after every scheduled auto-update.
 
pushd "%CHOCOLATEYINSTALL%\lib\curl\tools\curl*\bin"
setx CURL_EXE "%CD%\curl.exe"
popd
 
pushd "%CHOCOLATEYINSTALL%\lib\html-tidy\tools\tidy*\bin"
setx TIDY_EXE "%CD%\tidy.exe"
popd
 
REM Run this from the commandline to check the current version.
:: "%CURL_EXE%" --version
 
REM Or you can do the same in PowerShell...
:: $CurlDir = Get-ChildItem "$Env:ChocolateyInstall\lib\curl\tools\curl*\bin"
:: [System.Environment]::SetEnvironmentVariable('CURL_EXE', "$CurlDir\curl.exe", [System.EnvironmentVariableTarget]::User)
:: # Start-Process -FilePath "$Env:CURL_EXE" -ArgumentList "--version" -NoNewWindow -Wait
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎