Autorun functionality in Windows is often become the entrance of viruses into a computer, so turning off autorun function is the first to be done to secure the computer.
Here's How to Disable / Turn off Autorun in Windows 7
- Click Start > Run, type "gpedit.msc" and press Enter.
Go to Computer Configuration\Administrative Templates\Windows Components\Autoplay Policies\ and choose "Turn off Autoplay"
- To turn off Autoplay select Enabled, then select All Drives if you want to turn off all the autoplay function in all media including hard drives, or select CD-ROM and removable media drives to turn off autoplay only on CD ROM and USB flashdisk.

- However, if you want to restore the autorun function, select Disabled
Sometimes turning off autorun / autoplay with the tips above can still be bypassed by virus to run autoplay on your computer.
Nevertheless there are other effective way to turn off autoplay function throughout the storage media by turning off Autorun.inf files completely through the Windows registry.
Download the following file and run it on Windows, if there is the option to enter data into the registry press Yes.
Both of the tips above can be used to "turn off autorun in Windows 7, Vista and XP".