Skip to content

Instantly share code, notes, and snippets.

@yak1ex
Last active June 28, 2017 03:56
Show Gist options
  • Save yak1ex/28612fb8713ffb34be0ffb73ae22eab2 to your computer and use it in GitHub Desktop.
Save yak1ex/28612fb8713ffb34be0ffb73ae22eab2 to your computer and use it in GitHub Desktop.
chocolatey memo

profile

Before install, \Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 should have more than 4 bytes

feature

install location settings

  • jre8
    • choco install jre8 -p "/exclude:64" -ia 'INSTALLDIR=""c:\Program Files (x86)\Library\Java\jre""'  - choco install jre8 -p "/exclude:32" -ia 'INSTALLDIR=""c:\Program Files\Library\Java\jre""'
  • jdk8
    • choco install jdk8 -ia 'INSTALLDIR=""c:\Program Files (x86)\Library\Java\jdk""'
  • Git
    • choco install git.install -p '/NoAutoCrlf' -ia '/DIR=""c:\Program Files (x86)\ToolCUI\Git""'
  • StrawberryPerl  - choco install StrawberryPerl -ia 'INSTALLDIR=c:\usr\local\strawberry'
  • python2 (MSI)
    • choco install python2 -ia 'TARGETDIR=c:\usr\local\python2'
  • gtk-runtime (NSIS)
    • choco install gtk-runtime -ia '/D=c:\usr\local\gtk2'
  • libjpeg-turbo (NSIS)
    • choco install libjpeg-turbo -ia '/D=c:\usr\local\libjpeg-turbo'
      • CAN NOT handle spcifying install location properly
      • One possible resolution is getting from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\libjpeg-turbo 1.2.1@UninstallString  - choco install libjpeg-turbo
  • Irfanview  - choco upgrade irfanview -ia '/folder=""c:\Program Files\ToolGUI\IrfanView""'

Candidates

  • 7-Zip
  • AcrobatReader
  • AutoHotkey
  • Coq
  • Flash
  • FFmpeg
  • (FreeMind)
  • Git
  • IrfanView
  • JDK/JRE
  • MPC-HC
  • Nodist
  • Privoxy
  • Scilab
  • Sysinternals
  • WinMerge

Integration with own installation

# Extract afxw
$tfile=$env:TEMP+'\'+[System.IO.Path]::GetRandomFileName()
$base='http://akt.d.dooo.jp/'
$url=$base+'akt_afxw.html'
# Download as a string
$content=(New-Object System.Net.WebClient).DownloadString($url)
if($content -match '<a id="\$afxw32\$" href="(.*)">') { $url32=$matches[1] }
if($content -match '<a id="\$afxw64\$" href="(.*)">') { $url64=$matches[1] }
# Download as a file
(New-Object System.Net.WebClient).DownloadFile($base+$url32, $tfile)
# Extraction
& "${env:ChocolateyInstall}\tools\7z.exe" x "$tfile" "-o${env:ProgramFiles}\ToolGUI\afxw" -y
Remove-Item $tfile

Quote behaviour

old packages

  • choco install libjpeg-turbo -ia """/D=${env:ProgramFiles}\libjpeg-turbo"""

  • -installArguments '/D=C:\Program Files\libjpeg-turbo'

  • choco install libjpeg-turbo -ia '""/D=c:\Program Files\libjpeg-turbo""'

  • -installArguments '/D=c:\Program'

  • choco install libjpeg-turbo -ia '/D=""c:\Program Files\libjpeg-turbo""'

  • -installArguments '/D="c:\Program Files\libjpeg-turbo"'

  • choco install libjpeg-turbo -ia '/D=c:\Program` Files\libjpeg-turbo'

  • -installArguments '/D=c:\Program` Files\libjpeg-turbo'

  • choco install libjpeg-turbo -ia "/D=${env:ProgramFiles}\libjpeg-turbo /Dummy"

  • -installArguments '/D=C:\Program Files\libjpeg-turbo /Dummy'

new packages

  • choco install git.install -p '/NoAutoCrlf' -ia ('/DIR=""'+${env:ProgramFiles}+'\ToolCUI\Git""')

  • =>installed c:\Program Files\TooCUI\Git

  • choco install git.install -p '/NoAutoCrlf' -ia ('/DIR='+${env:ProgramFiles}+'\ToolCUI\Git')

  • =>installed c:\Program

  • choco install git.install -p '/NoAutoCrlf' -ia "/DIR=${env:ProgramFiles}\ToolCUI\Git"

  • =>installed c:\Program

  • choco install git.install -p '/NoAutoCrlf' -ia "/DIR=""${env:ProgramFiles}\ToolCUI\Git"""

  • =>installed c:\Program

  • choco install git.install -p '/NoAutoCrlf' -ia ("/DIR=""${env:ProgramFiles}\ToolCUI\Git""")

  • =>installed c:\Program

  • choco install git.install -p '/NoAutoCrlf' -ia "/DIR=""""${env:ProgramFiles}\ToolCUI\Git"""""

  • =>installed c:\Program Files\ToolCUI\Git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment