Create Bootable USB Flash Drive

By | August 4, 2014

Ever since Windows Vista, Microsoft has included all the necessary commands in diskpart to create a bootable USB flash drive.  Arguably the hardest part is making sure that you select the correct disk ID.  BootableUSB.vbs is a vbscript that makes it much easier to not only select the correct USB drive, but creates a diskpart script with all the required commands to prepare your USB flash drive.

BootableUSB.vbs system requirements and prerequisites…

  • Windows Vista, Windows 7, Windows 8.x, and Windows Server 2008, 2012
  • USB flash / thumb drive
  • USB compatible operating system (Microsoft Windows PE)
  • 7zip –  or other utility to unzip ISO file

The script displays a Windows User Account Control during startup, but does not make any changes on launch.  After launch a dialog box displays all USB drives found on the computer.

BootableUSB - Listing USB flash drives

BootableUSB – Listing USB flash drives

So, you can select a USB drive to prepare.  After you select a drive ID and confirm your selection the script creates a INPUT.TXT in the same folder as the BootableUSB.vbs script. Example INPUT.TXT script for diskpart…

  • select disk 1
  • clean
  • create partition primary
  • assign letter=E:
  • active
  • format fs=fat32 label=UsbBoot

Finally, the script executes the command, diskpart /s input.txt and displays the diskpart command status.  Typically the script will complete each command quickly.  The exception is the format fs=fat32 label=UsbBoot which can take long time to complete depending on the size and speed of the USB port and USB drive.

Once BootableUSB.vbs completes it displays summary information.  Now, you might expect that you can take the USB flash drive and use it to boot a computer.  And, you’d be sorely disappointed.  Even though BootableUSB prepares a USB drive to boot an operating system, you still need to add the actual operating system files on the USB drive.

Next, copy Windows PE operating system onto your newly prepared bootable USB flash drive.

After downloading PE2-500-Perc456, which includes Windows PE and includes support for Dell PERC 4, 5, 6 hard drive controllers, use 7zip to unzip the ISO file.

Then use Microsoft xcopy to copy the unzipped ISO files to the USB flash drive.  Using the INPUT.TXT example above you would type: xcopy  *.* /s/e/f E:\.  You can learn more about xcopy at Microsoft TechNet. Now, that you’ve copied the extracted ISO folders and files to the USB drive, you can use the USB flash drive to boot your computer.  Of course, you may need to set to your computer’s BIOS or UEFI settings to boot from the USB drive first.