Then what you mean is that the user needs to decide which system to back up, first boot into the corresponding system, then run your software to restart to DOS for backup, instead of backing up the partition of another system under one system.
In this way, it seems that you are not going to consider users of Linux systems, but simply want to make a program similar to one-click backup and restore under Windows.
This process actually involves 3 processes: writing a marker file to the partition of the current system you think, restarting to a DOS Shell, reading the marker files of all drive letters in order under DOS, and finally backing up and restoring the system according to the drive letters.
First, look at process 1. If the system boot program is in the first partition and the system main folder is in the second partition, which partition do you think should be backed up?
If the system unfortunately uses dynamic disks, then except for simple volumes, spanned volumes, striped volumes, and RAID-5 volumes will merge multiple disk spaces into one volume. Which partition do you think should be backed up?
If the system uses the NTFS file system and uses MountPoint to mount other data partitions as a directory of the system volume, is there a possibility that your file marker is exactly written to this MountPoint directory?
If a PE system is booted and the system volume is on a memory virtual disk, how should the backup be done after restarting?
If it is a diskless workstation Windows, how should the backup be done?
What if it is a Windows system with a shadow system or a restore card?
Then look at process 2. Restarting to boot into DOS seems simple. It only needs to write a boot entry to boot.ini under the system volume and then use the way of grldr or bootsect.dos to start. The problem is that the boot partition must specify the drive letter or partition number of the boot partition, and it is as confused as the problem in process 1.
Finally, look at process 3. After entering DOS, read the marker file. If there is an NTFS partition on the hard disk, the NTFS driver must be mounted. And basically, no matter what driver it is, it is after the CD-ROM driver, and the USB boot device that may be inserted will also be loaded, which makes the drive letter order under DOS very different from the physical partition order, and the CD-ROM drive letter may be confused among them. If there is no CD in the CD-ROM, then when traversing all drive letters to read the file, reading the CD-ROM without a CD will definitely report an error, and a lot of code is needed for error handling, and then continuous debugging...