Setting Drives in Cygwin

Unfortunately, my work machine isn’t a Mac and, while Cygwin works well, there are some warts. One of the worst ones is how it handles Windows terrible drive letters (Hey, no one wants to relive DOS . . . ). Cygwin uses /cygdrive/c/ for C:\, which I think is too wordy. For some reason, it took me a while to write a script to fix this but, now that I have, I’m so thankful. I run this when I log in and when I attach a drive I want to access:

#!/bin/sh

for d in `mount|grep cygdrive|cut -d : -f 1`; do
    if [ ! -e /$d ] ;then
        ln -s /cygdrive/$d /$d
    fi
done

Now I have /c/ as well as /cygdrive/c/. Nifty!

Leave a Reply

You must be logged in to post a comment.