I agree with Melvin: copy c:\file1 d: > d:\results.txt copy c:\file2 d: >> d:\results.txt blat.exe d:\results.txt (smtp settings omitted)
'>' will create (or overwrite) the results file, '>>' will append And if Powershell is available to you in your environment, it offers a lot more room to grow. FWIW. From: [email protected] [mailto:[email protected]] On Behalf Of Melvin Backus Sent: Tuesday, September 30, 2014 11:09 AM To: [email protected] Subject: [NTSysADM] RE: quick batch question Or do the redirection in the batch file itself instead. Do you really need to know that the blat operation worked? Afterall, you either got the email or you didn't. -- There are 10 kinds of people in the world... those who understand binary and those who don't. From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Jimmy Tran Sent: Tuesday, September 30, 2014 12:00 PM To: [email protected]<mailto:[email protected]> Subject: [NTSysADM] RE: quick batch question Ok, so it sounds like that is my only option. Two batch files it is. Thanks for the confirmation. From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Michael B. Smith Sent: Tuesday, September 30, 2014 7:57 AM To: [email protected]<mailto:[email protected]> Subject: [NTSysADM] RE: quick batch question You create a separate file that you redirect output to from each task and then email that file instead. From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Jimmy Tran Sent: Tuesday, September 30, 2014 10:48 AM To: [email protected]<mailto:[email protected]> Subject: [NTSysADM] quick batch question 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 ________________________________ This communication is for the use of the intended recipient only. It may contain information that is privileged and confidential. If you are not the intended recipient of this communication, the disclosure, copying, distribution or use hereof is prohibited. If you have received this communication in error, please advise me by return e-mail or by telephone and then delete it immediately.

