usb_drive = tk.simpledialog.askstring("USB Drive", f"Enter USB drive letter (e.g., E:)\nDetected: {drives}") if not usb_drive: return
self.log(f"\n--- Creating bootable USB on {usb_drive} from {iso_path} ---") self.log("This will FORMAT the USB drive. Continue?") if not messagebox.askyesno("Warning", f"All data on {usb_drive} will be erased. Continue?"): return winbootmate full
def fix_boot_errors(self): self.log("\n--- Attempting common boot fixes ---") self.run_admin_cmd("bootrec /fixmbr", "Fix MBR") self.run_admin_cmd("bootrec /fixboot", "Fix boot sector") self.run_admin_cmd("bootrec /scanos", "Scan for OS") self.run_admin_cmd("bootrec /rebuildbcd", "Rebuild BCD") self.log("Reboot to see if issues are resolved.") usb_drive = tk
def restore_bcd(self): backup_path = filedialog.askopenfilename(filetypes=[("BCD files", "*.bcd")]) if backup_path: self.log(f"\n--- Restoring BCD from {backup_path} ---") target = r"C:\Boot\BCD" if not os.path.exists(os.path.dirname(target)): target = r"C:\EFI\Microsoft\Boot\BCD" try: # Need to take ownership/disable protection? Just copy with admin subprocess.run(f'copy /Y "{backup_path}" "{target}"', shell=True, check=True) self.log("✓ Restore successful. Reboot to apply.") except Exception as e: self.log(f"✗ Restore failed: {e}") Just copy with admin subprocess
tk.Button(btn_frame, text="1. View Boot Entries", command=self.view_boot_entries, width=20).grid(row=0, column=0, padx=5, pady=5) tk.Button(btn_frame, text="2. Backup BCD", command=self.backup_bcd, width=20).grid(row=0, column=1, padx=5, pady=5) tk.Button(btn_frame, text="3. Restore BCD", command=self.restore_bcd, width=20).grid(row=0, column=2, padx=5, pady=5)