Winbootmate Full - [hot]

def run_admin_cmd(self, command, description=""): """Run a shell command that may need admin rights.""" try: self.log(f">>> {description or command}") result = subprocess.run(command, shell=True, capture_output=True, text=True) if result.returncode == 0: self.log("✓ Success") self.log(result.stdout) else: self.log("✗ Failed") self.log(result.stderr) return result except Exception as e: self.log(f"Error: {e}") return None

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) winbootmate full

def view_boot_entries(self): self.log("\n--- Current Boot Entries ---") self.run_admin_cmd("bcdedit /enum", "Enumerating BCD store") Restore BCD", command=self

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}") f"Enter USB drive letter (e.g.

usb_drive = tk.simpledialog.askstring("USB Drive", f"Enter USB drive letter (e.g., E:)\nDetected: {drives}") if not usb_drive: return

class WinBootMate: def (self, root): self.root = root self.root.title("WinBootMate - Boot Assistant") self.root.geometry("700x550") self.root.resizable(True, True)