if exist b:\. net use b: /delete if not exist b:\. net use b: \\XXXXXX\Backup /user:[domainname\]username] [password] /persistent:NO set logfile=E:\Backup\copyall.log xcopy B: E:\Backup\ /D /S /E /H /C /Y /R >> %logfile%