Go to Start menu > All programs > Accessories, right click on Command Prompt and select Run as administrator

Now type diskpart and press Enter
Next type Lis Disk command and note down the Disk number of your USB flash drive. Select disk 1

Now you can use following commands step by step
clean
create partition primary
select partition 1
active
format fs=ntfs
assign
exit

Now insert your Windows7/Windows 8 DVD in your CD/DVD drive and check the drive letter of the DVD drive and note down the “drive letter” of your DVD drive. In my case, it is “j:” Now type the following list of commands as shown below:
J: cd boot (Where “j” is my DVD drive letter).
cd boot
bootsect.exe /nt60 h: (Where “h” is my USB drive letter)
exit

Copy your Windows 7 DVD contents to the USB flash drive.
Your USB drive is ready to boot and install Windows 7.