Attach all user databases

I was doing an upgrade of one of our development servers to SQL Server 2008. To minimize the downtime I decided to attach all the user databases using script. Basically, I am attaching the db from the same location there were present earlier to being detached.
Consider the following example, If I have a database named “Test” in SQL 2005 that is currently residing in the following locations, C:databaseTest.mdf & C:databaseTest_log.ldf and another database named “Test_2008” in C:temptest_2k8.mdf & C:temptest2k8_log.ldf then the script I wrote would prepare the script to attach the database test from the same location.