How to write a Windows installer to USB flash drive from .iso

This will erase the flash drive. Data loss will occur if there's anything important on the drive before you start.

Not recommended for Apple Macs, and might not even work. Please refer to Apple's documentation on installing Windows on a Mac instead.

Microsoft has also published this procedure on its blog. The blog post predates this article.

Introduction

When you want to install a fresh Windows on a computer without an optical drive when you have nothing but an .iso file, you might find yourself a bit challenged. This article describes how you can format a flash drive on another Windows computer, so that it will boot the Windows installer. You can then use this flash drive to install a fresh copy of Windows. This method is known to work for all Windows versions from Windows Vista up to Windows 10, including server versions.

Formatting the flash drive

First, you must format the flash drive. Follow these instructions on a Windows machine with the flash drive inserted.

You need a Command Prompt with administrator privileges. In the Start/Metro -menu, type cmd. Rightclick cmd and click Run as Administrator. Now, run diskpart. Diskpart will re-partition and format the drive, and install Microsoft bootcode in the MBR. During this process, you will get a list of all disks that are available on the machine. Take note of the number in the output of list disk that corresponds to your flash drive, and use it in the select disk command.

Execution of diskpart

 

diskpart

Microsoft DiskPart version 10.0.10240

Copyright (C) 1999-2013 Microsoft Corporation.
On computer: DISKPART-DEMO

list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online           40 GB      0 B        *
  Disk 1    Online         7651 MB      0 B

select disk number

Disk number is now the selected disk.

clean

DiskPart succeeded in cleaning the disk.

create partition primary

DiskPart succeeded in creating the specified partition.

select partition 1

Partition 1 is now the selected partition.

active

DiskPart marked the current partition as active.

format fs=ntfs quick label="win-install"

  100 percent completed

DiskPart successfully formatted the volume.

exit

Leaving DiskPart...

exit

Copying the Windows installation files

Simply mount the .iso, and copy all files to the freshly formatted flash drive. If you are on Windows 8 or newer, this can simply be done by double-clicking the .iso. On Windows 7 and older, you need some third party software, like WinRAR.

Installing Windows

Now it's time to take the flash drive and put it in the computer where you want to install Windows. Make sure your EFI/BIOS boots from USB (often this can be done by pressing F11 or F8 during boot). Install Windows as you would normally do.