Before you proceed, I'd like you to know there are other third party softwares for the same, but won't you like to do it by yourself(even if you don't understand what's going on :P)?
And yeah, I have performed this for many friends of mine(Ram Nath, Vishal and Vikhyat are the most recent), whom I have always said that this is a complex procedure! But now that I fully understand it, I think you guys can perform it yourself!
N.B. Windows XP can't be installed in such a way because it's bootable disc doesn't contain the file BOOT/BOOTSECT.EXE
You will need: A flash drive (at least 4 GB) and a Windows 7/Vista installation DVD or ISO file
Softwares: WinRAR (in case of ISO file)
Insert the flash drive and open cmd (Programs/Accessories/Command Prompt). In Win 7/Vista, right click and select 'Run as administrator'
Type 'DISKPART' and press Enter. Wait for a few seconds and then run the command 'LIST DISK'.
In the list that pops up, locate your USB drive . Let us say it is 'Disk 1'
Run the following commands and wait for a confirmation after each step.
SELECT DISK 1
CREATE PARTITION PRIMARY
SELECT PARTITION 1
(this step takes about 15 minutes to complete; BE PATIENT)
Do not close the command prompt yet.
If you have a bootable DVD, insert it into your DVD drive. Let's say the drive is G: and your USB drive is H:
Run the following commands:
G: CD BOOT
Copy the contents of the DVD into the USB Drive!
In case you have an ISO file, open it using WinRAR, extract the 'Boot' folder to C: (considering your USB drive is H:), and run the following commands:
C: CD BOOT
Now, delete the 'Boot' folder in C: and extract the contents of the ISO file into the USB Drive!
Congratulations, you have successfully created your bootable flash drive :)
Thereafter, restart your computer with the USB stick inserted in one of the slots and start BIOS (generally you've to press 'Delete', 'F8' or 'F12' for that before Windows starts booting). Go to boot priority and put USB drive at the highest position (usually done using '+' and '-' keys, unless, of course you have Dell's GUI, where it can be done using the cursor). Save and exit, which will restart your computer again. And your computer boots up using the USB drive as if a Windows CD/DVD was inside, only this time, it's 5-10 times faster!