Address: http://blog.csdn.net/sabalol/article/details/7043313
1. First find Windows menuentry.
#Cat/Boot/grub2/grub. cfg |GrepWindows
Result:
Menuentry"Windows 7 (loader) (on/dev/sda1 )" -- ClassWindows-- ClassOS{
2. Set windows as the default startup Item (here you can only use the content in the double quotation marks "" or single quotation marks "in the Command output above)
#Grub2-set-default"Windows 7 (loader) (on/dev/sda1 )"
3. Verify the default startup Item
# Grub2-editenvList
Output:
Saved_entry =Windows 7 (loader) (on/dev/sda1)
4. Generate and update grub. cfg (optional)
The following command uses/etc/grub. the automatic configuration script under D and the variables defined in/etc/default/GRUB automatically generate the grub2 configuration file (including the kernel under/BOOT), and-O specifies the output file, /boot/grub2/grub. CFG is the default configuration file. If it is a multi-system, it will automatically find them and add them to the Startup Menu list.
# Grub2-mkconfig-O/boot/grub2/grub. cfg
Timeout and background images can be configured in/etc/default/grub.
For example:
Grub_timeout = 5
Grub_distributor = "fedora"
Grub_default = saved
Grub_cmdline_linux = "RD. md = 0 RD. LVM = 0 RD. dm = 0 keytable = us quiet sysfont = latarcyrheb-sun16 rhgb RD. luks = 0 lang = en_US.UTF-8"
Grub_background =/boot/grub2/background.png
Grub_terminal_output = gfxterm
Grub_theme =/boot/grub2/mytheme/theme.txt
Note: The following command sets fedora as the default startup Item:
#Cat/Boot/grub2/grub. cfg |GrepFedora
Result:
Menuentry 'ora ora Linux, with Linux 3.1.2-1. fc16.i686. pae' -- class fedora -- class OS {
Menuentry 'ora ora Linux, with Linux 3.1.1-1. fc16.i686. pae' -- class fedora -- class OS {
Menuentry 'ora ora Linux, with Linux 3.1.0-7. fc16.i686. pae' -- class fedora -- class OS {
# Grub2-set-default "Fedora Linux, with Linux 3.1.2-1. fc16.i686. PAE"
# Grub2-editenvList
# Grub2-mkconfig-O/boot/grub2/grub. cfg