This is the entire script:
---------------------------
@Echo off
REM Backup user files to external drive
REM.
REM.
SET prefix=robocopy_backup
SET source_dir="E:\users"
SET dest_dir="H:\BD_Users_Backup"
REM.
REM.
REM Set the log file name based on the current date. This
REM will record the results from the robocopy command.
REM The typical format for the date command is:
REM Mon 11/09/2000
SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log
SET what_to_copy=/COPY

AT /MIR
REM Exclude some files and directories that include transient data
REM that doesn't need to be copied.
SET exclude_dirs=/XD "Temporary Internet Files" "Cache" "Recent" "Cookies"
"iPod Photo Cache" "MachineKeys"
SET exclude_files=/XF *.bak *.tmp index.dat usrclass.dat* ntuser.dat* *.lock
*.swp
SET options=/R:0 /W:0 /LOG+:%log_fname% /NFL /NDL
ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% %exclude_dirs%
%exclude_files%
:END
---------------------------
But what is odd is, it creates the log file when run manually. It does not
when run from scheduler. This is on Sever 2008 standard.
"Pegasus [MVP]" <> wrote in message
news:...
>
>
> "JohnB" <> wrote in message
> news:...
>> I've always used xcopy in the past, but recently decided I need to become
>> familiar with RoboCopy. I found a sample batch file to back up folder(s)
>> to an external drive. Modified it a little. And it does just what I
>> need. When run manually it creates a log file with this command:
>> SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log
>>
>> But I'm running it from Task Scheduler. It ran fine last night, the
>> first time it was run. Everything backed up. But, no log file was
>> created.
>> How could running it from the scheduler affect that?
>
> Can't tell without knowing the value of %prefix%. Anyway, you can easily
> find out yourself by logging what's going on, e.g. like so:
> @echo off
> echo %date% %time%
> log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log>>c:\problem.txt
>
> It would also help if you posted your whole robocopy command line.