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)
- Navigate to: https://cygwin.com/setup-x86.exe
- Download the setup-x86.exe to a folder created at (C:\Downloads)
- Manually launch the Cygwin Installer
- Click Next on the Cygwin Net Release Setup Program screen
- Select Download Without Installing on the Choose a Download Source screen
- Set Local Package Directory to C:\Downloads & Click Next
- Select your preferred Internet Connection setting & Click Next
- Choose a Download Site from the list & Click Next
- Select Packages you want to include & Click Next
- Review and confirm your selections & Click Next
- Click Finish once the download has completed
- Navigate to the C:\Downloads folder
- Open the Cygwin folder (name will vary based on the download site you selected)
- Copy the noarch & x86 folders to C:\Downloads
- Now you can delete the Cygwin folder referenced in Step 13
- Open Notepad or your favorite text editor
- Add the following line:
setup-x86.exe --quiet-mode --local-install --local-package-dir %~dp0 --root C:\cygwin
- Save the file to “C:\Downloads” and name it Install-Cygwin.cmd
- Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
- Navigate to the C:\Downloads folder
- Enter the following command:
Install-Cygwin.cmd
- 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)
- Navigate to: https://cygwin.com/setup-x86_64.exe
- Download the setup-x86_64.exe to a folder created at (C:\Downloads)
- Manually launch the Cygwin Installer
- Click Next on the Cygwin Net Release Setup Program screen
- Select Download Without Installing on the Choose a Download Source screen
- Set Local Package Directory to C:\Downloads & Click Next
- Select your preferred Internet Connection setting & Click Next
- Choose a Download Site from the list & Click Next
- Select Packages you want to include & Click Next
- Review and confirm your selections & Click Next
- Click Finish once the download has completed
- Navigate to the C:\Downloads folder
- Open the Cygwin folder (name will vary based on the download site you selected)
- Copy the noarch & x86_64 folders to C:\Downloads
- Now you can delete the Cygwin folder referenced in Step 13
- Open Notepad or your favorite text editor
- Add the following line:
setup-x86_64.exe --quiet-mode --local-install --local-package-dir %~dp0 --root C:\cygwin64
- Save the file to “C:\Downloads” and name it Install-Cygwin.cmd
- Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
- Navigate to the C:\Downloads folder
- Enter the following command:
Install-Cygwin.cmd
- 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-windows | Allow old, unsupported Windows versions |
-a (or) --arch | Architecture to install (x86_64 or x86) |
-C (or) --categories | Specify entire categories to install |
-o (or) --delete-orphans | Remove orphaned packages |
-A (or) --disable-buggy-antivirus | Disable known or suspected buggy anti virus software packages during execution. |
-D (or) --download | Download packages from internet only |
-f (or) --force-current | Select the current version for all packages |
-h (or) --help | Print help |
-I (or) --include-source | Automatically install source for every package installed |
-i (or) --ini-basename | Use a different basename, e.g. “foo”, instead of “setup” |
-U (or) --keep-untrusted-keys | Use untrusted keys and retain all |
-L (or) --local-install | Install packages from local directory only |
-l (or) --local-package-dir | Local package directory |
-m (or) --mirror-mode | Skip package availability check when installing from local directory (requires local directory to be clean mirror!) |
-B (or) --no-admin | Do not check for and enforce running as Administrator |
-d (or) --no-desktop | Disable creation of desktop shortcut |
-r (or) --no-replaceonreboot | Disable replacing in-use files on next reboot. |
-n (or) --no-shortcuts | Disable creation of desktop and start menu shortcuts |
-N (or) --no-startmenu | Disable creation of start menu shortcut |
-X (or) --no-verify | Don’t verify setup.ini signatures |
--no-version-check | Suppress checking if a newer version of setup is available |
--old-keys | Enable old cygwin.com keys |
-O (or) --only-site | Do not download mirror list. Only use sites specified with -s. |
-M (or) --package-manager | Semi-attended chooser-only mode |
-P (or) --packages | Specify packages to install |
-p (or) --proxy | HTTP/FTP proxy (host:port) |
-Y (or) --prune-install | Prune the installation to only the requested packages |
-K (or) --pubkey | URL or absolute path of extra public key file (RFC4880 format) |
-q (or) --quiet-mode | Unattended setup mode |
-c (or) --remove-categories | Specify categories to uninstall |
-x (or) --remove-packages | Specify packages to uninstall |
-R (or) --root | Root installation directory |
-S (or) --sexpr-pubkey | Extra DSA public key in s-expr format |
-s (or) --site | Download site URL |
-u (or) --untrusted-keys | Use untrusted saved extra keys |
-g (or) --upgrade-also | Also upgrade installed packages |
--user-agent | User agent string for HTTP requests |
-v (or) --verbose | Verbose output |
-V (or) --version | Show version |
-W (or) --wait | When elevating, wait for elevated child process |
How to Uninstall Cygwin Silently
Check out the Cygwin Install and Uninstall (PowerShell) post for a scripted solution.
- Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
- 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.