Thanks Kurt.  That first option was what I was looking for.  I guess the only 
way to output each command is with a log switch for each command.

Thanks!

-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Kurt Buff
Sent: Tuesday, September 30, 2014 9:13 AM
To: [email protected]
Subject: Re: [NTSysADM] quick batch question

First, don't use copy - use robocopy instead.

Next, do it this way:

     robocopy c:\somedirectory\ d:\temp\ file1 /log d:\results.txt
     robocopy c:\someotherdirectory\ d:\temp\ file2 /log+ d:\results.txt
     blat.exe d:\results.txt -f [email protected] -subject "Copy Job 
Results" -t [email protected] -server exchange.somewhere.com

or this way, if both files are in the same directory:

     robocopy c:\somedirectory\ d:\temp\ file1 file2 /log d:\results.txt
     blat.exe d:\results.txt -f [email protected] -subject "Copy Job 
Results" -t [email protected] -server exchange.somewhere.com

Kurt

On Tue, Sep 30, 2014 at 7:47 AM, Jimmy Tran <[email protected]> wrote:
> I have a scheduled task to run a batch script to copy files.  In task 
> scheduler I run the command c:\batch.bat > d:\results.txt.
>
>
>
> Example of c:\batch.bat
>
> copy c:\file1 d:
>
> copy c:\file2 d:
>
> blat.exe d:\results.txt (smtp settings omitted)
>
>
>
> This fails to email because I get an error about opening the 
> d:\results.txt file since it is use by task scheduler.
>
>
>
> So my question is, what is the best way to email myself the logs for 
> this batch file?  I can’t think of any other way to do this other than 
> to have a separate task to email reults.txt, which I want to stay away from.
>
>
>
> TIA
>
>
>
> Jimmy



Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to