Link to home
Start Free TrialLog in
Avatar of cawasaki

asked on

send mailmessage in end of .bat script


I have a .bat script and i need to keep it.

at the end of the execution of .bat script, i need to add a code to send email.

this code must check one local folder, exemple:  T:\test\log, if it find one or many log file, it must send an email with every log file in attachement and delete all log files.

if the script not found any .log it do nothing.

thanks for help.

the script work in windows 2003 server.
Avatar of oBdA

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cawasaki



Remove the uppercase "ECHO"s in lines 18 and 24 to run it for real.

==> you mean line 20 and line 24 :)

i lunsh the script but it stuck at this and do nothing.

i have copy all blat file in the same folder of the .bat.

Attaching the following files: "E:\test\logs\log1.log","E:\test\logs\log2.log","
Blat v3.0.7 (build : Jul 20 2012 01:24:19)
32-bit Windows, Full, Unicode.....
Open a command prompt,enter "cd /d Y:\our\script\folder", and enter
blat.exe -?
This should print the blat help.
Then verify that you've configured the mail settings correctly, and that you may access port 25 on your mail server from this machine. Local virus scanners or firewalls as well as network firewalls may block this.
no firewall and no virus scanner.
Does blat print the help?
is blat just hanging, or is it returning to the command prompt after a while?
Is it reporting any error?
Can you ping the mail server?
it work now, i have add -body and it work fine.

how i can add another email adress destination in:


i need to send to 2 users


Sorry, couldn't test it here.
You can send the mail to several recipients by passing a comma separated list to blat:
ok thanks for help