Boot into Windows on Ubuntu Dual-Boot via Command Line

By | September 12, 2016

Frequently found myself needing a way to remotely boot into Windows from a Ubuntu dual-boot machine.

Looking at grub.cfg, I found there was only one “windows” option, so the following command allowed me to remotely boot into that partition via command line:

sudo grub-reboot “$(grep -i ‘windows’ /boot/grub/grub.cfg|cut -d”‘” -f2)” && sudo reboot

You can create a shell script to boot into windows on a schedule using cron. You will need to add it to the root crontab.

#!/bin/sh
# Script to boot into Windows partion on
# Ubuntu dual boot workstations
#
# If script does not work, you may need to do the following:
# sudo vi /etc/default/grub
#  replace GRUB_DEFAULT=0 with GRUB_DEFAULT=saved
# sudo update-grub
#
echo "Rebooting into MS Windows..."
sudo grub-reboot "$(grep -i 'windows' /boot/grub/grub.cfg|cut -d"'" -f2)" && sudo reboot