First, locate the disk on which Windows is installed. You may do this with the sudo fdisk -l command. This command will provide a list of all the floppy disks and partitions in the system. It displays the partitions of the /dev/sda disk, for example.
sudo fdisk -l #look to efi system
Then we need to get the UUID (?) of the relevant disk. We will manually add the output of this code to our boot file;
sudo blkid /dev/nvme0n1p1
The output from the blkid (?) command should look something like this. Get UUID from here. UUID for the following example: 2B11-51E9
# /dev/nvme0n1p1: UUID="2B11-51E9" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="01c6f628-9a5c-4d0e-9f59-02f390f0e28a"
Now we have to go to the grub.d directory and edit our file;
cd /etc/grub.d
nano ./40_custom
After you open the file, write your UUID in the part 2B11-51E9 and add this code;
menuentry 'Windows 11' {
search --fs-uuid --no-floppy --set=root 2B11-51E9
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
}
Now let's set the file permissions;
sudo chmod o-w 40_custom
Let's update grub so that our actions become valid;
sudo update-grub
Let's reboot the system and see what happens;
reboot
Following these steps, the Windows system will be added to the Ubuntu Terminal boot menu. When the system reboots, the Windows option appears in the boot menu.
Before I Forget
Finally, by running the grub-reboot command, you can specify which system you want to boot into. You can, for example, use the grub-reboot 0 command to make the first option in the boot menu (Windows) the default system.