Board logo

标题: [其他] 新手报道,贴个自己的作品,bat版天气查询 [打印本页]

作者: ardy    时间: 2018-5-9 13:34     标题: 新手报道,贴个自己的作品,bat版天气查询

tq.bat
用法:tq  [城市]
城市参数缺省时默认为IP定位城市。
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. if exist "D:\Path" (set _path_fl_=D:\Path) else (set _path_fl_=C:\Path)
  4. call %_path_fl_%\path.bat
  5. set "f=%*"
  6. if not defined f (
  7. for /f "delims=" %%i in ('call city') do set ct=%%i
  8. ) else (
  9. set ct=%1
  10. )
  11. echo !ct!的天气:
  12. for /f "delims=" %%i in ('call eurl !ct!') do set ct=%%i
  13. rem set ct=!ct:%%=%%%%!
  14. echo=>%tmp%\_tq_more_tmp_.txt
  15. for /f "delims=" %%i in ('call cjson "对不起,您没有权限发表 URL 连接,请返回修改。?city=!ct!"') do (
  16. set i=%%i
  17. set i=!i:{= !
  18. set i=!i:}= !
  19. set i=!i:[= !
  20. set i=!i:]= !
  21. set i=!i:"message": "Success ",= !
  22. set i=!i:"status": 200,= !
  23. set i=!i:"city"=城市!
  24. set i=!i:"count"=编号!
  25. set i=!i:"data"=现在天气!
  26. set i=!i:"shidu"=空气湿度!
  27. set i=!i:"pm25"=空气PM2.5!
  28. set i=!i:"pm10"=空气PM1.0!
  29. set i=!i:"quality"=空气质量!
  30. set i=!i:"wendu"=温度!
  31. set i=!i:"ganmao"=户外活动!
  32. set i=!i:"yesterday"=明天天气!
  33. set i=!i:"forecast"=七天天气!
  34. set i=!i:"date"=日期!
  35. set i=!i:"sunrise"=日出!
  36. set i=!i:"high"=最高温度!
  37. set i=!i:"low"=最低温度!
  38. set i=!i:"sunset"=日落!
  39. set i=!i:"aqi"=空气质量指数!
  40. set i=!i:"fx"=风向!
  41. set i=!i:"fl"=风级!
  42. set i=!i:"type"=天气状况!
  43. set i=!i:"notice"=提醒!
  44. set i=!i:,= !
  45. set i=!i:"= !
  46. echo=!i! >>%tmp%\_tq_more_tmp_.txt
  47. )
  48. more /s %tmp%\_tq_more_tmp_.txt
  49. del /F /Q %tmp%\_tq_more_tmp_.txt 2>nul
  50. endlocal
复制代码

作者: Batcher    时间: 2018-5-9 14:47

代码是不是没有贴完整?




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2