i explain my question.
I want to make a batch file to ping a multiple external IP (Around 20Ips) and then, when it end save a report in a txt file.
After all i want this batch send a mail with attachment (with mailsend)
Well i know mailsend commands but i'm not able to send a single mail after the process is end.
This is a code of my batch
Code: Select all
@echo off
set fnm=C:\Batch\IPList.txt
set lnm=C:\Batch\PingResults.txt
if exist %fnm% goto Label1
echo.
echo Cannot find %fnm%
echo.
Pause
goto :eof
:Label1
echo PingTest STARTED on %date% at %time% > %lnm%
echo ================================================= >> %lnm%
echo.
for /f %%i in (%fnm%) do call :Sub %%i
echo.
echo ================================================= >> %lnm%
echo PingTest ENDED on %date% at %time% >> %lnm%
echo ... now exiting
goto :eof
:Sub
echo Testing %1
set state=ONLINE
ping -n 1 %1
if errorlevel 1 set state=OFFLINE
echo %1 is %state% >> %lnm%
mailsend.exe **arguments**
So the code is correct, the problem is the mail send, sent me 20 mail and not only one with the end of work!
Thank you advance for your reply