📌 📄 内容摘要:
猛犸 (@Mengma) 在 一个小代码,记录自己的IP变化历史 中发帖
$logFile = "C:\path\to\your\ip_log.txt"
$checkInterval = 300 # 检查间隔,单位为秒(这里设置为5分钟)
function Get-ExternalIP {
try {
$ip = Invoke-RestMethod -Uri 'http://ipinfo.io/ip'
return $ip.Trim()
}
catch {
return $null
}
}
$lastIP = $null
while ($true) {
$currentIP = Get-ExternalIP
$currentTime = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
if ($currentIP...
────────── 链接信息 ────────── 🔗 论坛链接: linux.do 📎 访问地址: https://linux.do/t/topic/212943/1 ─────────────────────────────
📢 来源:LINUX DO