身為一個 windows 開發人員是不是有時會想把 nuget 功能擴大到 Visual Studio 之外的地方呢?!像 NPM 一樣,只要有 command line 就可以安裝程式,還不限於 Visual Studio 的相關功能?!Chocolatey 就可以達到這個目標了!
#安裝
commnad line(Cmd.exe)@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
commnad line(Cmd.exe) behind proxy@powershell -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH="%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
powershell
下載 install.ps1, 執行安裝
```
choco config set proxy http://proxyserver:proxyport
choco config set proxyUser UserName
choco config set proxyPassword password
```
$env:chocolateyProxyLocation='http://proxyserver:proxyport'
$env:chocolateyProxyUser = 'AD\UserName'
$env:chocolateyProxyPassword = 'password'
choco config get proxy
choco config get proxyUser
choco config get proxyPassword
$env:chocolateyProxyLocation
$env:chocolateyProxyUser
$env:chocolateyProxyPassword
choco config unset proxy
choco config unset proxyUser
choco config unset proxyPassword
$env:chocolateyProxyLocation=''
$env:chocolateyProxyUser=''
$env:chocolateyProxyPassword=''