Automating Windows installation on a secondary disk can save time and reduce errors. This guide explains how to use the WinToDisk batch script for clean deployments on both UEFI/GPT and BIOS/MBR systems.
Key Features
- Automated Partitioning: Handles UEFI (GPT) and legacy BIOS (MBR) layouts.
- Image Application: Applies
install.wimorinstall.esddirectly via DISM. - Boot Configuration: Automatically configures boot files using BCDBOOT.
- Recovery Environment: Sets up and configures WinRE.
Pre‑Run Configuration
- Section 2.1: Change temporary drive letters if W, Y, or U are already in use.
- Section 2.2: Adjust partition sizes (e.g., larger EFI partition for multi‑booting).
How It Works – Step by Step
- Admin Elevation: Requests administrator privileges.
- Drive Letter Check: Ensures temporary letters aren’t in use.
- Image Detection: Verifies the Windows image and edition index.
- Disk Selection: Lists available disks, blocks system disk.
- Firmware Choice: Select UEFI (GPT) or BIOS (MBR).
- Partitioning: DiskPart creates the layout automatically.
- Image Application: DISM applies the Windows image.
- Bootloader Setup: BCDBOOT writes boot files.
- Recovery Configuration: WinRE is set up.
- Cleanup: Temporary drive letters removed.
Quick Start Guide
- Connect the target disk (HDD/SSD).
- Download the WinToDisk script from GitHub.
- Prepare the Windows image:
- Download a Windows ISO from Microsoft.
- Mount the ISO and locate
install.wimorinstall.esdinsources. - Example:
F:\sources\install.wim.
Run the Script
- Right‑click and select Run as Administrator.
- Provide the image path (e.g.,
F:\sources\install.wim). - Select the Windows Edition index.
- Select the target disk (system disk is protected).
- Select boot mode (UEFI/GPT or BIOS/MBR).
- Wait for the script to finish applying the image, configuring boot, and recovery.
Boot from the New Drive
- On the same PC: set the new disk as the first boot device in BIOS/UEFI.
- For clients: connect the drive and boot.
On first boot, Windows continues with OOBE (Out‑of‑Box Experience) for region, keyboard, and account setup.
Verify Recovery
reagentc /info
Confirm WinRE is enabled. If disabled, run reagentc /enable.
Important Notes
- WinRE setup disables and re‑enables recovery to ensure proper configuration.
- Incorrect linking may occur if WinRE is tied to the Windows partition instead of the recovery partition.
- Always verify scripts downloaded from the internet. Inspect the code or use AI tools to audit for safety.
This script provides a streamlined, automated way to deploy Windows on a secondary disk, ensuring proper partitioning, boot configuration, and recovery setup.
By following these steps, you can achieve a clean, reliable installation process that mirrors official Windows Setup while saving time and effort.
Tags
Windows
.webp)