Go to http://finance.google.com, search for the stock you want. When you are seeing the stock information, in the top left corner there's a link that says 'Historical prices'. Click on it. then select the date range, click update (don't forget this) and 'Download to spreadsheet' (on the right, below the chart).
For example, this link takes you to the historical data for MSFT for the last 10 years.
http://finance.yahoo.com has something similar, like this. In this case the link to download a CSV is at the bottom of the table.