NOTE: The below method is only for 32-bit OS don't try it with 64 bit system. 64 bit OS can be installed by simple copying it to USB as because 64-bit system have the option in its BIOS to boot through USB.
- Connect the pendrive, and formt it in NTFS
- Launch the command prompt as administrator by right clicking on it and selecting 'Run as Administrator'
- Type diskpart and press [enter]
- Type list volume and press [enter]
- Type select volume <pendrive volume letter> and press [enter]
- Type active and press [enter]
- Exit from diskpart using exit command
- Insert the windows vista/7 disk
- In command prompt navigate to the boot directory on your DVD
- Type bootsect.exe/nt60 <pendrive letter>
- Now copy all files from DVD to root of the pendrive and now you have a bootable pendrive.
There is also a simpler way to do this using universal usb as shown in below video