1

The following is my nightly_backup.bat file, scheduled to run every night at 11pm.

But though it does the backups ok, I never find it paused in the morning, like I expect it.

echo off
ROBOCOPY C:\PRIMARY  B:\BACKUP\PRIMARY\  /e /NFL /NDL   
ROBOCOPY B:\BACKUP\    E:\BACKUP\  /e /NFL /NDL   
ROBOCOPY B:\ARCHIVE\   E:\ARCHIVE\  /e /NFL /NDL   



rem  Backup favorites-
ROBOCOPY C:\Users\douglaskbell\Favorites  C:\BACKUP\FAVORITES\  /e /NFL /NDL   
ROBOCOPY C:\Users\douglaskbell\Favorites  B:\BACKUP\FAVORITES\  /e /NFL /NDL   
ROBOCOPY C:\Users\douglaskbell\Favorites  E:\BACKUP\FAVORITES\  /e /NFL /NDL   

DATE /T
pause

:EXIT
DATE /T
Appleoddity
  • 11,970
Doug Null
  • 908

1 Answers1

0

Assuming you've scheduled this via the Windows Task Scheduler, try scheduling the task to run with the account of the user you're logging in as (assuming you have the correct permissions to run robocopy). If, for example, you're scheduled task's security options are configured for SYSTEM, you will not see the paused cmd window.

Test this with a new .bat:

echo off
DATE /T >> C:\log.txt
pause

Configure a scheduled task for this script using your username. Run it, and you'll see the creation of C:\log.txt along with a paused cmd window. If you delete this log file, change the scheduled task to run as SYSTEM and run the task, you'll see the creation of the log file, but no paused cmd window.

root
  • 3,920