This is a method to monitor changes in the computer's IP address using batch processing and notify via email.
We will use a small program: blat
A mail sending program for Windows, you can download blat from the official website or download all the files I packaged.
We only need one program: blat.exe, to be used with batch processing.
We need to create two batch files.
The first batch file reads the system IP address and compares it. If different, it will invoke another batch file to send an email.
@echo off
ipconfig | findstr "IPv4 IPv6"> IP1.txt
echo n|comp IP.txt IP1.txt >nul 2>&1
if errorlevel 1 (
ipconfig | findstr "IPv4 IPv6" > IP.txt
call sendmail.bat
) else (
echo Same
)
exit
This command will generate two txt files and compare the contents of the two files for differences. If different, it will open the sendmail.bat batch file, which is used to send emails. Just set it to run every 10 minutes in the system task scheduler, and you will receive an email notification whenever the system IP changes.
Email sending batch file
@echo off
set s="IP address has changed, please modify it as soon as possible" # Email subject
set mail=IP.txt # This is the IP address file generated above
set [email protected] # Recipient's email address
set f="My Computer<[email protected]>" # Sender's email name
set [email protected] # Sender's email
set pw=EYOASDASDASFSDYS # Sender's email authorization code, many email clients now require this authorization code to log in, which can be obtained from the email provider's official website
blat %mail% -s %s% -to %t% -server smtp.163.com -f %f% -u %fa% -pw %pw% -charset Gb2312 # Sender's email server smtp.163.com, if using QQ email, it would be smtp.qq.com
I have packaged all the files, with a total size of only 50kb.
IP Scheduled Detection.rar extraction code: ax3m