How to create Windows 10 bootable USB with Command Prompt

You can use Diskpart to create a USB bootable flash drive to install Windows 10 on any computer, and this guide, you'll learn how to do it.

Windows 10 create USB from Command Prompt
Windows 10 create USB from Command Prompt

Although you can create a bootable USB to install Windows 10 using a variety of tools, including the Media Creation Tool and Rufus, it is also possible to use the DiskPart command-line tool to create a flash drive to clean install Windows 10 from Command Prompt.

In this guide, you will learn the steps to use Command Prompt to create a USB bootable media to install Windows 10. Also, before proceeding, you will need to connect a USB flash drive with at least 8GB of space to your computer and the ISO file of Windows 10, which you can download with these steps.

Create USB bootable media to install Windows 10

To create a USB flash drive to install Windows 10, use these steps:

  1. Open Start on Windows 10.

  2. Search for Command Prompt, right-click the top result, and select the Run as Administrator option.

  3. Type the following command to open DiskPart and press Enter:

    diskpart
  4. Type the following command to determine the USB flash drive and press Enter:

    list disk
  5. Type the following command to select the storage and press Enter:

    select disk 1
    Quick tip: The select disk 1 command as an example, but you have to replace “1” with the number of the flash drive you want to use.
  6. Type the following commands to delete everything from the USB thumb drive and press Enter:

    clean

    dislpart clean USB flash drive

  7. Type the following command to create a primary partition and press Enter:

    create partition primary
  8. Type the following command to select the new partition and press Enter:

    select partition 1
  9. Type the following command to make the selected partition active and press Enter:

    active
  10. Type the following command to make the USB flash drive bootable and press Enter:

    format FS=NTFS quick
    Quick tip: If you’re creating a bootable media for a device that uses UEFI, you’ll need to format the drive using the “FAT32” file system, instead of “NTFS” with the format fs=FAT32 quick command.
  11. Type the following command to assign a volume and a drive letter for the USB flash drive and press Enter:

    assign letter=X

    In the command, change X for any available letter you want to use.

    diskpart prepare USB flash drive

  12. Type the following command to quit the tool and press Enter:

    exit
  13. Type the following command to mount the ISO file and press Enter:

    PowerShell Mount-DiskImage -ImagePath "C:\path\to\Windows10.iso"

    Windows 10 ISO mount command

    In the command, make sure to update the path with the location where you have stored the ISO file.

  14. Type the following command to launch DiskPart again and press Enter:

    diskpart
  15. Type the following command to determine the drive letter for the mounted ISO file and press Enter:

    list volume

    diskpart check mounted ISO drive letter

  16. Type the following command to exit DiskPart and press Enter:

    exit
  17. Type the following command to access the Windows 10 ISO file and press Enter:

    E:
  18. Type the following command to access the boot folder and press Enter

    cd boot
  19. Type the following command to update the volume boot code for the USB flash drive and press Enter:

    bootsect /nt60 X:
  20. Type the following command to copy all the Windows 10 files to the USB flash drive and press Enter:

    xcopy E:\*.* X:\ /E /F /H

    Create Windows 10 bootable USB flash drive

    In the command, change the E and X drive letters with the correct drive letters for the Windows 10 ISO image and the USB flash drive respectively.

Once you complete the steps, you can use the bootable flash drive to install Windows 10 on computers using BIOS or UEFI.

About the author

Mauro Huculak is a Windows expert and the Editor-in-Chief who started Pureinfotech in 2010 as an independent online publication. He is also been a Windows Central contributor for nearly a decade. Mauro has over 12 years of experience writing comprehensive guides and creating professional videos about Windows, software, and related technologies, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 20 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me.