DEV Community

Cover image for How to create a bootable flash drive with command prompt(cmd)
Sadisha Nimsara
Sadisha Nimsara

Posted on

How to create a bootable flash drive with command prompt(cmd)

In order to install windows to a computer that no DVD ROM, you need to prepare a bootable flash drive for that.

Formatting the flash drive

First of all, plug-in a flash drive with a minimum of 4GB of capacity. Now, go to windows explorer, right-click on your flash drive and format it in a regular way.

Create a partition in the command prompt

Next, you have to set up your flash drive to make it a bootable drive. To do that, you have to open your command prompt with Run as administrator. And then, type the following command in your cmd.

diskpart
Enter fullscreen mode Exit fullscreen mode

This opens the diskpart.exe program. Now type,

list disk
Enter fullscreen mode Exit fullscreen mode

And hit enter. This command shows information about all the drives that are connected at the time. Now you have to identify your flash drive with its capacity and remember its disk number. (eg: Disk 1)
List disk results

Then, type the following command and hit enter.

select disk 1
Enter fullscreen mode Exit fullscreen mode

This will show a message that “Disk 1 is now the selected disk.” Now you have to remove the default setting in your flash drive. Type,

clean
Enter fullscreen mode Exit fullscreen mode

and hit enter. This will show the message “DiskPart succeeded in cleaning the disk.”
clean result

To create a bootable disk, you need to have a separate partition for that. For that, type

create partition primary
Enter fullscreen mode Exit fullscreen mode

and hit enter. This will show “succeeded in creating the specified partition.” Now you need to select the partition. For that, type,

select partition 1
Enter fullscreen mode Exit fullscreen mode

and hit the enter key. This shows “Partition 1 is now selected partition.” message. Now you have to make that partition active. Type,

active
Enter fullscreen mode Exit fullscreen mode

This will show you “DiskPart marked the current partition as active.”
active results

Formatting the partition

Now, you need to format the partition as suitable. In order to do that, Type,

format fs=fat32 quick
Enter fullscreen mode Exit fullscreen mode

and enter. Now, flash drive will be formatted, then shows “100 percent completed” and “DiskPart success fully formatted the volume.”

Now you have to assign a dive letter to the flash drive. Type,

assign
Enter fullscreen mode Exit fullscreen mode

and enter. This will show the message “DiskPart successfully assigned the drive letter or mount point.”
assign results
Now you are done with the command prompt and you can close it by typing exit and hit enter.
Now, you are almost done! :)

Copy the setup files

This is the last step of the process. You need to copy all the windows installation files to your flash drive.

Now you can install windows to a computer using this flash drive.

Top comments (0)