• You really need three scripts since they have to be run in different places.

    The source does the backup or detach and needs to run on the source server.

    The copy is an OS job, and it can be run on either source or destination, or a workstation, but if it's under XP_CMDSHELL, the service accounts or proxy need rights to do this. It's probably easier to manually copy data and log files (mdf/ndf/ldf)

    The restore/attach is run on the destination.