Skip to content

Instantly share code, notes, and snippets.

@scarolan
Created July 7, 2013 22:09
Show Gist options
  • Save scarolan/5945168 to your computer and use it in GitHub Desktop.
Save scarolan/5945168 to your computer and use it in GitHub Desktop.
Powershell code for installing cygwin packages.
# Download and install cygwin and some packages
function Install-Cygwin {
param ( $TempCygDir="$env:temp\cygInstall" )
if(!(Test-Path -Path $TempCygDir -PathType Container))
{
$null = New-Item -Type Directory -Path $TempCygDir -Force
}
$client = new-object System.Net.WebClient
$client.DownloadFile("http://cygwin.com/setup.exe", "$TempCygDir\setup.exe" )
# This does a vanilla installation of Cygwin
Start-Process -wait -FilePath "$TempCygDir\setup.exe" -ArgumentList "-q -n -l $TempCygDir -s http://mirrors.kernel.org/sourceware/cygwin/ -R c:\Cygwin"
# Comma-separated list of packages you want goes at the end
Start-Process -wait -FilePath "$TempCygDir\setup.exe" -ArgumentList "-q -n -l $TempCygDir -s http://mirrors.kernel.org/sourceware/cygwin/ -R c:\Cygwin -P openssh, cygrunsrv, ncurses, vim, python, ruby, cron"
}
# then you just run it!
Install-Cygwin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment