@echo off set "myCity=beijing" set "fileUTF8=%temp%\AQI.UTF8" set "fileTMP=%temp%\AQI.TMP" set "fileANSI=%temp%\AQI.ANSI" wget -q "http://www.pm25x.com/city/%myCity%.htm" -O "%fileUTF8%" sed -r "/rt-title/!d; s#.*<b>(.*)</b>(.*)</div>#\1 \2#" "%fileUTF8%" > "%fileTMP%" sed -r "/aqivalue/!d; s#.*>(.*)</div>#[PM2.5] \1#" "%fileUTF8%" >> "%fileTMP%" sed -r "/aqileveltext/!d; s#.*>(.*)</div>#\1#" "%fileUTF8%" >> "%fileTMP%" sed "/utip/!d; s#.*utip..##; s#</div>##" "%fileUTF8%" >> "%fileTMP%" powershell -c "Get-Content ‘%fileTMP%‘ -Encoding utf8 | Out-File -Encoding default ‘%fileANSI%‘" type "%fileANSI%" pause
wget.exe sed.exe 下载地址:
http://bbs.bathome.net/s/tool/index.html
批处理查询PM2.5实时空气质量指数(AQI)
http://bbs.bathome.net/thread-38817-1-1.html
本文出自 “Batcher” 博客,请务必保留此出处http://batcher.blog.51cto.com/11779161/1794373
Windows批处理BAT脚本查询PM2.5实时空气质量指数(AQI)
原文地址:http://batcher.blog.51cto.com/11779161/1794373