You can't do it in Windows.
Boot from Ubuntu installation DVD or USB drive and choose 'Try Ubuntu without installing'.
Mount the partition of your Ubuntu Installation. If you are not sure which one, launch GParted (included in the Ubuntu installation DVD or USB)
or.
Open a terminal (Ctrl+Alt+T) and use the following command:
sudo fdisk -l
and find out. It is usually a EXT4 Partition. Replace the XX with the drive letter, and partition number, for example: sudo mount /dev/sda1 /mnt.
sudo mount /dev/sdXX /mnt
XX being the partition where Ubuntu is installed.
If there is a separate boot partition.
sudo mount /dev/sdXY /mnt
XY being your boot partition.
for efi boot.
sudo mount /dev/sdXZ /mnt/boot/efi
sdXZ being the efi partition.
Now bind the directories that grub needs access to to detect other operating systems, like so.
sudo mount --bind /dev /mnt/dev &&
sudo mount --bind /dev/pts /mnt/dev/pts &&
sudo mount --bind /proc /mnt/proc &&
sudo mount --bind /sys /mnt/sys
then
sudo gedit /mnt/etc/default/grub
edit it save and go to that using chroot.
sudo chroot /mnt
Now update grub.
update-grub
Now grub is back, all that is left is to exit the chrooted system and unmount everything.
exit &&
sudo umount /mnt/sys &&
sudo umount /mnt/proc &&
sudo umount /mnt/dev/pts &&
sudo umount /mnt/dev &&
sudo umount /mnt
Shut down and turn your computer back on, and you will be met with the default Grub2 screen.
Modified from this.