Modify install.ps1 like below (Adding proxy):
# ==============================================================================
#
# Fervent Coder Copyright 2011 - Present - Released under the Apache 2.0 License
#
# Copyright 2007-2008 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# ==============================================================================
#Proxy
#$proxyAddr = (get-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').ProxyServer
$proxy = new-object System.Net.WebProxy("proxy_url")
#$proxy.Address = $proxyAddr
$proxy.useDefaultCredentials = $true
# variables
$url = "http://chocolatey.org/api/v2/package/chocolatey/"
$chocTempDir = Join-Path $env:TEMP "chocolatey"
$tempDir = Join-Path $chocTempDir "chocInstall"
if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir)}
$file = Join-Path $tempDir "chocolatey.zip"
function Download-File {
param (
[string]$url,
[string]$file
)
Write-Host "Downloading $url to $file"
$downloader = new-object System.Net.WebClient
$downloader.proxy = $proxy
$downloader.DownloadFile($url, $file)
}
# download the package
Download-File $url $file
# download 7zip
Write-Host "Download 7Zip commandline tool"
$7zaExe = Join-Path $tempDir '7za.exe'
Download-File 'https://github.com/chocolatey/chocolatey/blob/master/src/tools/7za.exe?raw=true' "$7zaExe"
# unzip the package
Write-Host "Extracting $file to $tempDir..."
Start-Process "$7zaExe" -ArgumentList "x -o`"$tempDir`" -y `"$file`"" -Wait
#$shellApplication = new-object -com shell.application
#$zipPackage = $shellApplication.NameSpace($file)
#$destinationFolder = $shellApplication.NameSpace($tempDir)
#$destinationFolder.CopyHere($zipPackage.Items(),0x10)
# call chocolatey install
Write-Host "Installing chocolatey on this machine"
$toolsFolder = Join-Path $tempDir "tools"
$chocInstallPS1 = Join-Path $toolsFolder "chocolateyInstall.ps1"
& $chocInstallPS1
write-host 'Ensuring chocolatey commands are on the path'
$chocInstallVariableName = "ChocolateyInstall"
$chocoPath = [Environment]::GetEnvironmentVariable($chocInstallVariableName, [System.EnvironmentVariableTarget]::User)
$chocoExePath = 'C:\Chocolatey\bin'
if ($chocoPath -ne $null) {
$chocoExePath = Join-Path $chocoPath 'bin'
}
if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower()) -eq $false) {
$env:Path = [Environment]::GetEnvironmentVariable('Path',[System.EnvironmentVariableTarget]::Machine);
}
# update chocolatey to the latest version
#Write-Host "Updating chocolatey to the latest version"
#cup chocolatey
Run install.ps1 via below command:
@echo off
SET DIR=%~dp0%
%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "& '%DIR%install.ps1' %*"
相关推荐
用于Web筛选代理的Chocolatey程序包此存储库包含Chocolatey Web过滤代理的来源。如何建造在尝试构建软件包之前,请确保已阅读的《快速入门指南》。 从现在开始,我们假设以下内容。 您已在Windows 10的最新版本上...
Chocolatey离线安装包,需要使用powershell脚本(详见官网或者csdn文章:Chocolatey离线安装步骤)来安装,用于解决在线安装时文件获取失败的问题。
chocolatey-cookbook, 在 Windows 上,厨师 cookbook 要安装chocolatey和包 描述使用默认的配方安装 Chocolatey,并使用方便的资源/提供者管理包。要求平台:Windows厨师 11.6或者更高版本手册:Windows ( ~> 1.38 )...
用于Chocolatey软件包管理器的快速入门实用程序
内网中无法连接外网,可离线安装巧克力Chocolatey工具
这是在 windows 安装 Chocolatey 的脚本,直接导入到 PowerShell 就可以安装
通过Chocolatey安装WinDump和WinPcap 由于没有WinDump和WinPcap的静默安装程序,因此很难自动安装它们。 特别是在没有GUI的Windows Server Core上,甚至无法手动安装。 该项目旨在通过采用Chocolatey解决这些问题...
安装您可以通过执行以下操作通过Chocolatey本身安装Chocolatey GUI: choco install ChocolateyGUI 如果您有兴趣尝试使用Chocolatey GUI的最新预发行版,则可以使用以下安装命令: choco install chocolateygui --...
解压放到c:\ProgramData\chocolatey 里面有可以使用的 c:\ProgramData\chocolatey\lib\ack\ c:\ProgramData\chocolatey\lib\elixir\ c:\ProgramData\chocolatey\lib\erlang\ c:\ProgramData\chocolatey\lib\...
: Install-Module au或choco install au 。 可以使用test_all.ps1脚本测试脚本,不使用任何参数运行脚本以强制更新所有软件包,或者传递软件包名称以强制更新单个软件包。 请注意,这将使用来更新版本,因此需要...
$ npm install @chocolatey/when 概要 import when from '@chocolatey/when' const onPageShow = when ( done => { window . addEventListener ( 'pageshow' , done ) } ) // callback onPageShow ( event => ...
Chocolatey-类似于yum或apt-get,但适用于Windows 你可以叫我巧克力。建置状态团队城市AppVeyor 特拉维斯聊天室在我们的Gitter聊天室中加入有关Chocolatey的对话。 或者,您可以在freenode上#chocolatey的IRC中找到...
Chocolatey-像yum或apt-get,但对于Windows,您可以叫我choco。 Build Status聊天室支持Chocolatey! 请参阅有关通信信息文档的Chocolatey实际使用礼节Chocolatey-例如yum或apt-get,但对于Windows,您可以称呼我...
Chocolatey自动包装 该存储库包含由巴塞尔大学的IT服务创建的自动巧克力包。
ansible-role-chocolatey:使用Ansible在Microsoft Windows上安装Chocolatey软件包管理器
内网中无法连接外网,可离线安装巧克力Chocolatey工具
该模块可让您从Nuget提要中安装Chocolatey二进制文件,并可以选择指定要使用的版本,Proxy和Credentials。 该项目采用了Microsoft开源行为准则。 有关更多信息,请参见《行为准则》常见问题解答,或与联系,并提出...
巧克力吉特该存储库是可与git一起使用的Chocolatey工具的集合。 目的是演示如何对管道中的choco包进行打绒/验证,以及如何将git和Chocolatey一起使用。CI / CD管道工具chocopackages.Tests.ps1一组验证包装的测试。 ...
巧克力包装这些是我维护的一些包。 Chocolatey 是 Windows 的二进制包管理器。