How to restore Windows boot loader after removing Ubuntu

Solution 1:

This depends on whether your operating systems are installed in UEFI mode or Legacy mode.
(If your PC is manufactured in the last 5-6 years, and came pre-installed with an operating system, it will most likely be UEFI.)
There is a similar question that you can follow to check whether you are using Legacy or UEFI.

Note: Irrespective of which mode you install in, if you simply delete the Ubuntu partition, it won't make the Windows bootloader default automatically. You have to do it once, manually.

If you install in Legacy mode and then delete the Ubuntu partition

You'll most likely end up in a grub rescue prompt on the next boot. You'll need a bootable recovery disk (either Windows or Linux) to help you restore your Windows boot sector.
Here is a similar question that can help in this case.

If you install in UEFI mode and then delete the Ubuntu partition

You'll most likely end up in a GRUB command line prompt on the next boot, from where you'll have to boot to Windows and delete the GRUB EFI Firmware entry or change the order to put the Windows bootloader in the first place.
Here is a similar question that can help in this case.

So, what's the better way?

For Legacy

Boot to Windows first and use the bootsect tool to replace the GRUB boot sector with the Windows boot sector, and then delete the Ubuntu partition. Run these from an elevated Command Prompt :-

bootsect /nt60 SYS /mbr
bootsect /nt60 SYS

For UEFI

Manually delete the GRUB EFI boot entry and/or set the Windows bootloader to the first position before you get rid of Ubuntu.
This answer to a similar question explains the process for deleting it in Windows.

To perform this from Ubuntu, the efibootmgr tool can be useful. Run :-

sudo efibootmgr -v

to see the entries currently in your bootloader, then run :-

sudo efibootmgr -b XXX -B

to delete entry XXX.