We help IT Professionals succeed at work.

Scheduled Task Notification

I have batch file run automatically via server 2003 scheduled tasks.  The batch file is copying a fixed backup drive to a removable drive for rotations, it would be nice to be notified via e-mail if that copy has finished.  Is there a way to accomplish this?
@echo off
 
setlocal
 
del /s /q E:\Backup
 
xcopy F:\BVRC01_Backup E:\Backup /E

Open in new window

Comment
Watch Question

Commented:
Hi,

I haven't tried it but how about this http://www.freedownloadscenter.com/Email_Tools/Misc__Mail_Tools/V_Mailer.html

It should allow you to send mails from the command line in dos or in batch files.

Stef

Commented:
Sorry just in case that was unclear...
If you use that piece of software (it's freeware), you could add the command to send the mail to the end of you batch script scipt.

There is more info at http://www.virdi-software.com/vmailer/

The command is of the format:

Usage: VMAILER.EXE FileName SmtpServer To From User Password

where:
FileName = name of text file containing the message
SmtpServer = server name or IP address e.g. smtp.domain.com
To = recipient's address e.g. him@domain.com
From = sender's address e.g. me@domain.com
User = (optional) user name if authentication reqd.
Password = (optional) password if authentication reqd.

Most Valuable Expert 2019
Most Valuable Expert 2018

Commented:
You can use blat.exe (http://www.blat.net/) to send the email after xcopy is done, and attach xcopy's output to the email, for example like this:

@echo off
setlocal
set LogFile=C:\Temp\BackupLog.log
 
del /s /q E:\Backup
xcopy F:\BVRC01_Backup E:\Backup /E >>"%LogFile%" 2>&1
blat.exe "%LogFile%" -server <MailServer> -f backup@your.domain.com -t Recipient@your.domain.com -s "Backup finished with errorlevel %Errorlevel%"

Open in new window