• I tried your method and it does not work - for example:

    USE ENTERPRISE_SERVERS

    GO

    EXEC master.dbo.sp_dboption 'ENTERPRISE_SERVERS','autoclose',true

    GO

    DECLARE @cmd VARCHAR(255)

    SET @cmd = 'copy C:\SQLDATA\ENTERPRISE_SERVERS.mdf "C:\BACKUPS\"'

    EXEC master.dbo.xp_cmdshell @cmd

    EXEC master.dbo.sp_dboption 'ENTERPRISE_SERVERS','autoclose',false

    GO

    ..................returns the folllowing error:

    The process cannot access the file because it is being used by another process.

    ...........which defeats the purpose