1) The following script will generate T-SQL to create the databases once you've moved the files. It's important to do this step before anything else.
SELECT 'create database ' + QUOTENAME(DB_NAME(d.database_id)) + ' on ' +
STUFF((
SELECT ',(name = ''' + name + ''', filename = ''' + [physical_name] + ''')'
FROM sys.[master_files] AS mf
WHERE [mf].[database_id] = d.[database_id]
FOR XML PATH('')
), 1, 1, '') + ' for attach'
FROM sys.[databases] AS d
WHERE d.name NOT IN ('master', 'model', 'tempdb', 'msdb')
If the path to the data files on the new server isn't the same as on the old server, you can edit the file names in the script (or do something fancier in the query to do it for you automatically).
2) The following code will generate a T-SQL script to set the database status to offline for all non-system databases. If your plan is to set the original server offline (which wouldn't be a bad idea), then this step is unnecessary as the database files will not be in use by the server.
select 'alter database ' + quotename(name) + ' set offline'
from sys.[databases] as d
WHERE d.name NOT IN ('master', 'model', 'tempdb', 'msdb')
3) Bring the databases offline either through shutting down the original server or executing the T-SQL from step 2 on the original server
4) Move the files to the new server
5) Execute the script from step 2 on the new server.