Avi,
just want to say thanks for posting the script, I have over 300 databases to move and this script will be most useful. ( I have done a successful trial run on a test bed server)
Only change I would make is use 'print (@runalter)' rather than 'select (@runalter)' so only the commands you actually want are reversed engineered out, also all the databases could be offlined, files moved, then bought on-line again if you want to avoid a service restart.
cheers
george
---------------------------------------------------------------------