Cygwin Silent Install (How-To Guide)

Cygwin is a POSIX-compatible programming and runtime environment that runs natively on Microsoft Windows. Under Cygwin, source code designed for Unix-like operating systems may be compiled with minimal modification and executed. This article will serve as an informative guide and give you a clear understanding of how to perform a silent installation of Cygwin from the command line using the EXE installer.

How to Install Cygwin Silently

Cygwin 32-bit Silent Install (EXE)

  1. Navigate to: https://cygwin.com/setup-x86.exe
  2. Download the setup-x86.exe to a folder created at (C:\Downloads)
  3. Manually launch the Cygwin Installer
  4. Click Next on the Cygwin Net Release Setup Program screen
  5. Select Download Without Installing on the Choose a Download Source screen
  6. Set Local Package Directory to C:\Downloads & Click Next
  7. Select your preferred Internet Connection setting & Click Next
  8. Choose a Download Site from the list & Click Next
  9. Select Packages you want to include & Click Next
  10. Review and confirm your selections & Click Next
  11. Click Finish once the download has completed
  12. Navigate to the C:\Downloads folder
  13. Open the Cygwin folder (name will vary based on the download site you selected)
  14. Copy the noarch & x86 folders to C:\Downloads
  15. Now you can delete the Cygwin folder referenced in Step 13
  16. Open Notepad or your favorite text editor
  17. Add the following line:
    • setup-x86.exe --quiet-mode --local-install --local-package-dir %~dp0 --root C:\cygwin
  18. Save the file to “C:\Downloads” and name it Install-Cygwin.cmd
  19. Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
  20. Navigate to the C:\Downloads folder
  21. Enter the following command: Install-Cygwin.cmd
  22. Press Enter

After a few moments you should see the Cygwin Desktop Shortcut appear. You will also find entries in the Start Menu and Installation Directory.

Software Title:Cygwin
Vendor:Cygnus Solutions
Architecture:x86
Installer Type:EXE
Silent Install Switch:setup-x86.exe --quiet-mode --local-install --local-package-dir %~dp0 --root C:\cygwin
Silent Uninstall Switch:See Uninstall Section Below
Download Link:https://cygwin.com/setup-x86.exe
PowerShell Script:https://silentinstallhq.com/cygwin-install-and-uninstall-powershell/
Detection Script:https://silentinstallhq.com/create-a-custom-detection-script-for-cygwin-powershell/

Cygwin 64-bit Silent Install (EXE)

  1. Navigate to: https://cygwin.com/setup-x86_64.exe
  2. Download the setup-x86_64.exe to a folder created at (C:\Downloads)
  3. Manually launch the Cygwin Installer
  4. Click Next on the Cygwin Net Release Setup Program screen
  5. Select Download Without Installing on the Choose a Download Source screen
  6. Set Local Package Directory to C:\Downloads & Click Next
  7. Select your preferred Internet Connection setting & Click Next
  8. Choose a Download Site from the list & Click Next
  9. Select Packages you want to include & Click Next
  10. Review and confirm your selections & Click Next
  11. Click Finish once the download has completed
  12. Navigate to the C:\Downloads folder
  13. Open the Cygwin folder (name will vary based on the download site you selected)
  14. Copy the noarch & x86_64 folders to C:\Downloads
  15. Now you can delete the Cygwin folder referenced in Step 13
  16. Open Notepad or your favorite text editor
  17. Add the following line:
    • setup-x86_64.exe --quiet-mode --local-install --local-package-dir %~dp0 --root C:\cygwin64
  18. Save the file to “C:\Downloads” and name it Install-Cygwin.cmd
  19. Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
  20. Navigate to the C:\Downloads folder
  21. Enter the following command: Install-Cygwin.cmd
  22. Press Enter

After a few moments you should see the Cygwin Desktop Shortcut appear. You will also find entries in the Start Menu and Installation Directory.

Software Title:Cygwin
Vendor:Cygnus Solutions
Architecture:x64
Installer Type:EXE
Silent Install Switch:setup-x86_64.exe --quiet-mode --local-install --local-package-dir %~dp0 --root C:\cygwin64
Silent Uninstall Switch:See Uninstall Section Below
Download Link:https://www.cygwin.com/setup-x86_64.exe
PowerShell Script:https://silentinstallhq.com/cygwin-install-and-uninstall-powershell/
Detection Script:https://silentinstallhq.com/create-a-custom-detection-script-for-cygwin-powershell/

The information above provides a quick overview of the software title, vendor, silent install, and silent uninstall switches. The download links provided take you directly to the vendors website. Continue reading if you are interested in additional details and configurations.


Additional Configurations

Exclude the Cygwin Desktop Shortcut During Install

The Cygwin installers create a desktop shortcut by default. If you do not want the desktop shortcut, then you can run the following command line switches to exclude it.

Cygwin 32-bit Silent Install (EXE) with No Desktop Shortcut

setup-x86.exe --quiet-mode --local-install --local-package-dir %~dp0 --root C:\cygwin --no-desktop

Cygwin 64-bit Silent Install (EXE) with No Desktop Shortcut

setup-x86_64.exe --quiet-mode --local-install --local-package-dir %~dp0 --root C:\cygwin64 --no-desktop

Additional Command Line Switches

--allow-unsupported-windowsAllow old, unsupported Windows versions
-a (or) --archArchitecture to install (x86_64 or x86)
-C (or) --categoriesSpecify entire categories to install
-o (or) --delete-orphansRemove orphaned packages
-A (or) --disable-buggy-antivirusDisable known or suspected buggy anti virus
software packages during execution.
-D (or) --downloadDownload packages from internet only
-f (or) --force-currentSelect the current version for all packages
-h (or) --helpPrint help
-I (or) --include-sourceAutomatically install source for every package installed
-i (or) --ini-basenameUse a different basename, e.g. “foo”, instead of “setup”
-U (or) --keep-untrusted-keysUse untrusted keys and retain all
-L (or) --local-installInstall packages from local directory only
-l (or) --local-package-dirLocal package directory
-m (or) --mirror-modeSkip package availability check when
installing from local directory (requires
local directory to be clean mirror!)
-B (or) --no-adminDo not check for and enforce running as Administrator
-d (or) --no-desktopDisable creation of desktop shortcut
-r (or) --no-replaceonrebootDisable replacing in-use files on next reboot.
-n (or) --no-shortcutsDisable creation of desktop and start menu
shortcuts
-N (or) --no-startmenuDisable creation of start menu shortcut
-X (or) --no-verifyDon’t verify setup.ini signatures
--no-version-checkSuppress checking if a newer version of setup is available
--old-keysEnable old cygwin.com keys
-O (or) --only-siteDo not download mirror list. Only use sites
specified with -s.
-M (or) --package-managerSemi-attended chooser-only mode
-P (or) --packagesSpecify packages to install
-p (or) --proxyHTTP/FTP proxy (host:port)
-Y (or) --prune-installPrune the installation to only the requested packages
-K (or) --pubkeyURL or absolute path of extra public key
file (RFC4880 format)
-q (or) --quiet-modeUnattended setup mode
-c (or) --remove-categoriesSpecify categories to uninstall
-x (or) --remove-packagesSpecify packages to uninstall
-R (or) --rootRoot installation directory
-S (or) --sexpr-pubkeyExtra DSA public key in s-expr format
-s (or) --siteDownload site URL
-u (or) --untrusted-keysUse untrusted saved extra keys
-g (or) --upgrade-alsoAlso upgrade installed packages
--user-agentUser agent string for HTTP requests
-v (or) --verboseVerbose output
-V (or) --versionShow version
-W (or) --waitWhen elevating, wait for elevated child process

How to Uninstall Cygwin Silently

Check out the Cygwin Install and Uninstall (PowerShell) post for a scripted solution.

  1. Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
  2. Enter one of the following sets of commands:

Cygwin 32-bit Silent Uninstall (EXE)

TASKKILL /F /IM bash.exe
TASKKILL /F /IM mintty.exe
DEL "%Public%\Desktop\Cygwin*.lnk"
RMDIR /Q /S "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Cygwin"
takeown /a /r /d Y /f C:\cygwin
RMDIR /Q /S "C:\cygwin"
REG DELETE "HKLM\Software\Cygwin" /f
REG DELETE "HKCU\Software\Cygwin" /f

Cygwin 64-bit Silent Uninstall (EXE)

TASKKILL /F /IM bash.exe
TASKKILL /F /IM mintty.exe
DEL "%Public%\Desktop\Cygwin*.lnk"
RMDIR /Q /S "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Cygwin"
takeown /a /r /d Y /f C:\cygwin64
RMDIR /Q /S "C:\cygwin64"
REG DELETE "HKLM\Software\Cygwin" /f
REG DELETE "HKCU\Software\Cygwin" /f

Always make sure to test everything in a development environment prior to implementing anything into production. The information in this article is provided “As Is” without warranty of any kind.