You can prevent computer viruses by installing an anti-virus program on your computer, which scans files for known viruses. There are a number of these programs on the market, and they can be purchased from software stores or acquired on the Internet. Once installed, you will need to regularly update anti-virus files, which are used to detect and remove viruses from your system.