Tag Archives: Windows

Bash in Windows

One of the things I like least about programming in Windows is the command prompt.  I don’t know if it’s navigation is just bad or just too different from the Linux terminals that I am used to but I can’t stand using it.  The PowerShell is definitely better, but I would rather just have a unified terminal across my systems not to mentions some of the useful command line applications that are standard with Linux.  And Bash is the winner for me.

I have been using Cygwin on my Windows machines for quite a while now but mostly only for Linux command line programs (ls, ls, ls,…) and it wasn’t until recently that I thought about running a bash terminal through Cygwin.  When you first install Cygwin you will probably get a shortcut on your desktop or start menu for the “Cygwin Terminal” (if not then see Creating a Cygwin Terminal Shortcut) and if you open it you’ll get something like this:


When I first saw this I immediately dismissed it because it was, well, ugly.  However, if you type the help command into this terminal, you will see the following message:


This terminal is running Bash!  Problem solved, end of post right?  Well it’s still not quite the way I want it for a couple of reasons:

  1. By default, the terminal will start in the ‘C:\cygwin64\home\user’ directory (or wherever you installed Cygwin) or it might be the ‘/cygdrive/c/WINDOWS/system32’ directory
  2. It’s still ugly!

Thankfully, both of these can be fixed easily.  I’ll start with the second problem.

Problem 1 – Starting Directory

Problem #1 is annoying for me because I want my terminal to act like Bash terminal but run over my regular Windows files.  Therefore, I don’t want to have to migrate all of my files from ‘C:\Users\user’ to the Cygwin directories; I just want it to open in my Windows user directory.  So, if you’re like me and you want to do this, just follow these steps:

    1. Open the Cygwin terminal as described above.  Make sure it is the Cygwin terminal and not the Windows command prompt.
    2. Navigate to the ‘/home’ directory.
    3. You may or may not have a user directory in the home directory.  If you do, move all of the ‘.*’ files to your Windows user directory and then delete the user directory in ‘/home’.
    4. Create a symlink to your Windows user directory in ‘/home’ by executing the following command: ln -s /cygdrive/c/Users/user where ‘user’ is your Windows username.
    5. If step #3 above did not apply to you, create a .bashrc file in your Windows user directory and edit it.  If it did apply to you, then you can just edit the existing .bashrc file.
      1. Add the line cd /home/user where user is the same username you used in step #4.

Now whenever you open the Cygwin terminal it will place you in your Windows user directory.

Problem 2 – Bash with Style

So the default Bash style through Cygwin is pretty ugly.  This style is controlled through the .bashrc file that you should be able to find in your Linux home directory.  The default Cygwin home directories also come with a .bashrc file but it is mostly empty.  If you already do some custom .bashrc modifications to your Linux machines then you can go ahead and copy them to your Windows machine and you’re all set.  If not, then I would recommend copying the default .bashrc file from your favorite Linux distribution.  If you don’t have access to a Linux machine, then you can usually find a download for these files, such as for Ubuntu.

Once you have a .bashrc file with the styling that you like, you just need to place it in your home directory.  If you followed the directions for Problem #1 above then this will be your Windows user directory.  If not then it will be your Cygwin user directory which is located in the ‘C:\cygwin64\home’ directory (or wherever you installed Cygwin).

Now all of your terminals will have the style of your choosing.


Creating a Cygwin Terminal Shortcut

Cygwin uses a terminal emulator called MinTTY.  You can find this program in the bin folder of your Cygwin installation, which by default is located at ‘C:\cygwin64\bin’.  So all you have to do is create a shortcut to mintty.exe.


Lenovo W541 Synaptics Touchpad Scroll Causes Tiny Mouse

I recently bought a new Lenovo W541 with 3K display.  The W541 uses Synaptics UltraNav driver for handling touchpad and trackpoint gestures.  When scrolling a window with the touchpad, the Synaptics software changes the cursor to have some fancy scrolling cursor.  After done scrolling, the software reverts to the regular cursor but a much smaller version (about half the size I think).

I’m not sure if this has anything to do with poor support for displays larger than 1080p but the rest of the software works really great and I didn’t want to do away with it but I cannot live with a tiny cursor after every time that I scroll.

I was able to revert to the regular cursor size in Windows mouse settings (Right Click Desktop -> Personalize -> Change mouse pointers -> Pointers tab) by changing the scheme to something and then back to the default and applying.  Unfortunately the Synaptics software changes the cursor back to a miniature version every time you scroll with the touchpad.

I was able to find a more permanent solution with the following method:

  1. Close the Synaptics software with the Task Manager (Ctrl + Shift + Esc).  It usually has 3-4 processes running.
  2. Download the Resource Hacker freeware tool.
  3. Run Resource Hacker as administrator and open the C:\Program Files\Synaptics\SynTP\SynTPEnh.exe file.  It should look similar to the below image.


  1. Expand the Cursor header in the left pane. By clicking any of the entries in this list, you will display the embedded cursor images which the Synaptics software uses.  The cursors used for scrolling are numbers 41, 43, 64, and 65.  For each of these cursors right click the entry in the left pane and select Replace Cursor.  This will open the menu depicted in the following image.


  1. Click the Select file with new cursor… button.  Navigate to the C:\Windows\Cursors directory.  Now you need to select the default cursor for the theme you have selected.  The default theme uses the aero_arrow.cur file.  Select the cursor and click Open.
  2. Back in the Replace Cursor menu shown above, click the Replace button. Repeat this process for each of the scrolling cursors listed above.
  3. Once all of the cursors have been replaced, click the save button in Resource Hacker.  Resource Hacker will automatically save a backup of the EXE file so you don’t need to worry about creating a backup manually.

At this point, if you were to restart the Synaptics software and scroll with the touchpad it would not change to the scroll cursor but the cursor will still shrink.  This is because there were actually three different versions of the cursor we replaced the originals with, one which is 32×32, one which is 48×48, and another which is 64×64.  Synaptics will always choose the 32×32 one for some reason and then the cursor will stay that size afterwards.  Now we just need to delete the two smaller cursors so it will always use the 64×64 version.  Unfortunately, if you try to do this in Resource Hacker, it will delete all three sizes.  However, another freeware tool called, Anolis Resourcer can achieve this.

  1. Download Anolis Resourcer.
  2. Run Anolis as administrator and open the C:\Program Files\Synaptics\SynTP\SynTPEnh.exe file.  Then click on the Cursor Image header in the left pane.  It should look similar to the below image.


  1. The first 12 cursors correspond to the three different sizes of the four cursors we replaced.  You can identify the size of each cursor by double clicking it, double clicking it again, and then clicking the small Show Information button on the toolbar.  For convenience, the cursors that should be deleted are 2, 3, 5, 6, 8, 9, 11, and 12.  In order to delete a cursor, you need to expand the cursor all the way in the left pane, click the cursor number, click the Delete button on the toolbar, and then click OK.  Repeat this for each of the listed cursors.


  1. After deleting all of the necessary cursors, click the Save button.
  2. Restart the Synaptics software.  I am not sure which executable needs to be launched for this so I wound up just restarting my computer.

Using the touchpad to scroll should no longer change the cursor.

For reference, I was using Windows 8.1 Pro and Synaptics ClickPad V1.1 on SMB Port Driver Version: installed via the Lenovo Software Update tool.  The current software versions when writing this article were 4.2.4 for Resource Hacker and 0.9.3531.38736 for Anolis Resourcer.