I am working on a system automation process which will use Powershell to install Chocolatey to install Cygwin. I would subsequently like to install the prerequisites for apt-cyg, which will allow me to programatically install packages from cygwin. However, I do not know where the setup.exe binary for Cygwin is placed when installed with Chocolatey.
-
Are you using this exact package? https://chocolatey.org/packages/Cygwin – Anthony Mastrean Feb 02 '15 at 18:58
2 Answers
I downloaded the cygwin package and inspected the chocolateyInstall.ps1
. Looks like the package downloads the exe
installer and passes the target folder.
$binRoot = Get-BinRoot
$cygRoot = join-path $binRoot "cygwin"
$cygPackages = join-path $cygRoot packages
# https://cygwin.com/faq/faq.html#faq.setup.cli
$silentArgs = "-q -R $cygRoot -l $cygPackages -s http://mirrors.kernel.org/sourceware/cygwin/"
$validExitCodes = @(0)
Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" "$url64" -validExitCodes $validExitCodes
The target folder is combined using the Chocolatey "binroot" folder. Here's where this gets messy... There are a bunch of legacy locations for this folder. The foolproof method is to import the Chocolatey helper module and execute Get-BinRoot
. You need to find your Chocolatey install folder, too.
PS> Import-Module $ENV:CHOCOLATEYINSTALL\chocolateyInstall\helpers\chocolateyInstaller.psm1; Get-BinRoot
That will dump a folder name, on my system (and most systems with the latest Chocolatey and no manual changes to that path or any other Environment variables)
C:\tools
So, the cygwin binaries should be under some path like
C:\tools\cygwin
FYI, the cygwin package does recommend installing the cyg-get package for this kind of thing.

- 21,850
- 21
- 110
- 188
It's not an answer to where you can find the setup.exe
, but you can actually use some package manager for Cygwin to manage packages. Some of them are standalone applications or scripts, some of them are just wrappers around Cygwin's setup.exe
. Check my answer to How do I install cygwin components from the command line? for a list of some of them.
Also, there is the cyg-get
in the Chocolatey's repository, which is, in fact, a wrapper around the setup.exe
written in PowerShell.

- 1
- 1

- 23,966
- 9
- 79
- 68