I wanted a quick way to boot once to Windows. Typically I reboot and hold the Option key to select an alternate startup disk. I've decided that I will upgrade the video card on my Mac Pro to an ATI 6870. Since there is currently no way to flash the card to EFI I will not be able to see the boot drive options when I boot holding down Option.
And I don't want to change the boot drive every time I want to boot to Windows. When I'm done with Windows I like to just reboot and leave knowing the rest will just happen.
I came up with this little script:
#! /bin/bash
diskutil list > /tmp/connecteddrives.txt
INPUT=/tmp/connecteddrives.txt
driveid1=$(grep Microsoft "${INPUT}" | awk '{print $8}')
echo $driveid1
sudo /usr/sbin/bless --device /dev/$driveid1 --setBoot --legacy --nextonly
rm /tmp/connecteddrives.txt
exit 0
Mac OS X Hints
http://hints.macworld.com/article.php?story=20110925090353107