Skip to content

Instantly share code, notes, and snippets.

@sometimesfood
Created March 19, 2012 18:39
Show Gist options
  • Save sometimesfood/2123373 to your computer and use it in GitHub Desktop.
Save sometimesfood/2123373 to your computer and use it in GitHub Desktop.
Bash script to reboot UEFI systems to Windows
#!/bin/bash
set -e
WIN_REGEXP='Boot\([[:digit:]]*\)\* Windows Boot Manager$'
WIN_BOOT_ENTRY=$(efibootmgr | grep -e "${WIN_REGEXP}" | head -1)
WIN_BOOT_NUM=$(echo ${WIN_BOOT_ENTRY} | sed -e "s/${WIN_REGEXP}/\1/g")
efibootmgr --quiet --bootnext ${WIN_BOOT_NUM}
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment