Saturday, August 10, 2013

Reboot to Windows

I have a laptop and during everyday use the lid is always closed as it is plugged in an external monitor and other periferals.

Unfortunately grub is invisible on the external screen on a restart, so I had to find an other way to boot into windows.

First, you edit grub:
sudo gedit /etc/default/grub

Find this: GRUB_DEFAULT=0
and replace with this: GRUB_DEFAULT=saved

Now run the update:

sudo update-grub

Next, find out what is the number of the Windows entry in grub. The easyest way is to check it on the next restart. Don't forget to substract one from the number, as the menu starts from 0. If windows is the 6th elemnt, your lucky number id 5...

Now, create a script in ~/bin, call it simplay "win". Put this in it:

#!/bin/bash
sudo grub-reboot 5
sudo reboot

Don't forget to check the number, 5 is only an example. Also don't forget to give yourself rights to run the script...

By typing win in your terminal, the computer should restart in Windows.