How to Create a Pinned Cygwin Icon in Windows 7

Pinned Cygwin icon

When you install Cygwin, it creates a shortcut to the Cygwin.bat file that resides in the installation directory.  But if you try to pin it to the Windows 7 taskbar with drag-and-drop, it won’t work.  Here’s how you can do it:

  1. Right-click on the desktop, and in the context menu, select New->Shortcut.
  2. In the dialog box, enter the location of the shortcut item.  If Windows and Cygwin are installed in the default locations, it will be something like:
  3. C:\Windows\System32\cmd.exe /c C:\cygwin\Cygwin.bat

  4. Click “Next”.  Enter “Cygwin” for the shortcut name.  An icon with the C:\ command prompt will appear on your desktop.
  5. Right-click the icon and view Properties.  Click the “Change Icon…” button.  Browse to the Cygwin installation directory and select Cygwin.ico.
  6. Double-click the new desktop shortcut and make sure the Bash shell appears.  Right-click the icon in the taskbar and select and select “Pin this program to the taskbar”.  You’re done!

Alternatively, you could just run cmd.exe, pin it to the taskbar, and edit the properties to run Cygwin.bat while it’s pinned.  But then you would not be able to alter the icon as easily.

18 thoughts on “How to Create a Pinned Cygwin Icon in Windows 7

    1. Did you follow the numbered steps or did you just use the technique in the last paragraph? I tried it myself to make sure it does in fact work. Is anybody else having problems with this?

  1. Interesting: if I follow your instructions, it works. If I open the desktop shortcut that the cygwin installer created, it fails as”asdf” described.
    In any case, thanks for providing this workaround. Guess Win7 is still miles behind OS X 🙂
    Carl

  2. Thanks for the tip. I found this and now I use it for other apps that I need to start via cmd. Actually, it is fairly simple to change the icon after you have pinned it to the taskbar. (i.e. your “alternative” solution). Just R-click on the pinned icon, and again R-click on the app name. You can then select the properties option and change your icon under the “Shortcut” tab.

  3. Your tip worked great! Thanks! One question… why couldn’t I pin the original Cygwin shortcut that it created on my desktop? Why don’t they do what you described here?

  4. Those who are having problems should make sure not to use the batch file but to make sure they’re using the location said above which points first to the cmd.exe
    I made that mistake 😛

    (Reblogged this)

  5. I also had asdf’s problem, but I found a solution. I followed the steps exactly and the shortcut it created worked just fine. When i tried to pin it, though, all it would pin is a shortcut to the windows command prompt.

    I un-pinned it and took another look at the properties on my shortcut. It looks like despite the fact that I pasted:
    C:\Windows\System32\cmd.exe /c C:\cygwin\Cygwin.bat

    as the shortcut target, windows changed it to just “C:\cygwin\Cygwin.bat”. All I had to do to fix it was re-open the shortcut’s properties and change the target back to:
    C:\Windows\System32\cmd.exe /c C:\cygwin\Cygwin.bat

    Then I re-launched the shortcut and right-clicked the task bar icon and told it to pin. Now everything works.

    No clue why windows changed the target path…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s