This article assumes that you have a CD-ROM drive and Linux Live CD (such as Ubuntu), and use GRUB as the bootloader.
After installing the Basic Windows system, start with Live CD, go to the Linux desktop, enable Terminal, switch sudo-s to root, and then perform the following steps:
# Grub
Grub> root (hd0, 7)
Grub> setup (hd0)
Grub> quit
# Shutdown-r now
After the machine is restarted, the familiar grub interface is displayed again. :)
Note that there are spaces after the root and setup Commands. In addition, I would like to explain the meanings of hd0 and hd0 and 7: hd is short for Hard Disk, 0 indicates the first Hard Disk, and 7 indicates the partition numbered 7. If you are not sure about the Partition Number of the original Linux installation, you can press the [TAB] key after "root (hd0, the file system type and partition size are clearly displayed in the list.
This article from http://www.blogjava.net/sean/archive/2007/01/23/95605.html