troubleshooting Question

Send email confirmation from batch file

Avatar of eli290
eli290 asked on
Windows BatchMicrosoft DOSScripting Languages
2 Comments1 Solution1880 ViewsLast Modified:
I have an xcopy batch job running and I would like to send myself a notification once it is completed. I am trying to use blat but cant seem to get it to work. Here is what I have so far. The backup job works fine no problem. I dont get any errors from the blat code but i dont get anything.

rem @echo off
set log=e:\shares\error.txt
xcopy E:\Shares\ y:\ /s /y /c /h > %log% 2>&1 && Goto 

AllOK

Echo %date% %time% There was an ERROR copying ACCT - Error %errorlevel% >>e:\shares\error.txt
C:\email\blat.exe -to mail@email.com

server servername -f mail@email.com -attach "e:\shares\error.Txt"

pause
exit /b

:allok

Echo %date% %time% There were no errors copying Fundbalance UB >>e:\shares

\fundbalance\fb\ub\backup\error.txt

set hostname=servername
set subject="Backup successful"
set toaddress=deliver-email-mail@email.com
set attach=e:\shares\error.txt


pause
exit /b
ASKER CERTIFIED SOLUTION
eli290

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros