Install Vista / Win 7 from Pen Drive

Here is a cool trick(in fact, a built in utility in vista/win 7) to make a pen drive bootable and use it to install vista or win 7 from it. What you are required to have is a pen drive (4 GB+) and vista/win 7 iso/DVD and a laptop or a PC. :P

So, if all is set we proceed, as follows:

First, open cmd prompt as administrator. Then type following commands one by one.
(Note: comments(#) are shown for the purpose of understanding and they are definitely not part of commands.)

diskpart
# Opens DISKPART utility built-in in vista/win 7

list disk
# Lists the available disks for installation

select disk 1
# select the disk 1 or 2 or 3 or so on.. i.e. pen drive disk which is there in the list

clean
# cleans the disk

create partition primary
# creates the primary partition

select partition 1
# does as specified

active
#....

foramt fs=NTFS
# format it with NTFS file system. it will take some time! :(

assign
# mounts the disk

exit
# get exit from diskpart utility

Don’t close the cmd prompt as we need to execute one more command at the next step. Just minimize it.
Now mount the iso using virtual drive manager like Power iso or insert dvd. We assume D: be the drive letter of it.

go to D:\BOOT folder from minimized cmd promp window.

Type another command given below to update the USB drive with BOOTMGR compatible code.

bootsect.exe /nt60 g:
# here g: is the assumed drive letter of pen drive. Change it, if different.

Copy your Windows 7/Vista DVD contents to the USB flash drive.
Now your pen drive is bootable.

Only thing you need to change the boot priority at the BIOS to USB from the HDD or CD ROM drive. I won’t explain it as it’s just the matter the changing the boot priority or enabling the USB boot option in the BIOS.