Boot to Windows partition quickly

Sep 27, '11 07:30:00AM

Contributed by: MVasilakis

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
You may need to change the awk '{print $8}' command if you have spaces in your Boot Camp volume name.

To find out if it will work simply type this into terminal:

diskutil list|grep Microsoft|awk '{print $8}'

If you get something along the lines of disk#s# it works. If not change the number 8 up or down by one till you find it. Then modify the script accordingly, make it executable and enjoy.

[crarko adds: I don't use Boot Camp, so I haven't tested this one.]

Comments (14)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20110925090353107