This script allows you to generate script to detach and attach one or all databases from your local SQL Server instance. This can be very useful when performing maintenance, upgrade, backups of files, relocating data/log files to other drives, etc. You no longer need to remember the long hard-coded file path after detaching the database since this procedure takes care of generating the entire command along with the path for you.
This script also takes care of the 16 file limit when using SP_Attach_DB system stored procedure. Please follow the help for successful implementation of this script.