[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 求助批处理提取指定行的指定字段并输出成变量

不能插图也不能上传附件。。。。
如下是TXT 内容
Description,Value
Battery Name,02DL008
Manufacture Name,SMP
Serial Number, 2669
Manufacture Date,
Power State,"Charging, AC Power"
Current Capacity (in %),67.6%
Current Capacity Value,"29,920 mWh"
Full Charged Capacity,"44,260 mWh"
Designed Capacity,"50,450 mWh"
Battery Health,87.7%
Voltage,"12,868 millivolts "
Charge/Discharge Rate ,"32,852 milliwatts "
Chemistry ,LiP
Low Battery Capacity (1),200 mWh
Low Battery Capacity (2),"2,213 mWh"
Critical Bias,
Number of charge/discharge cycles,184
Battery Temperature,
Remaining battery time for the current activity (Estimated),
Full battery time for the current activity (Estimated),
Remaining time for charging the battery (Estimated),
Total  time for charging the battery (Estimated),

需要提取第11行Battery Health,87.7%和18行Number of charge/discharge cycles,184 的第二字节 并输出成变量,这个是做电池健康度监控使用的,Battery Health 必须大于95%,而充放电次数小于等于3, 但是我目前只能
  1. for /f "skip=10 delims=, tokens=2 " %%i in (scomma.txt) do echo %%i
复制代码
只能显示10行和之后的输出,百度了各种也成功不了,新手入门,难度太大,还请大佬不吝赐教!
小Z

回复 2# pd1


   学习了,谢谢
小Z

TOP

回复 3# terse


    这个运行提示 此处不该出现else   我研究下,感谢感谢!
小Z

TOP

回复 6# hfxiang

谢谢!~~~
小Z

TOP

链接:https://pan.baidu.com/s/1hUqCjhlsLnp44ETG_T-tzg
提取码:1234
文档上传了百度网盘
小Z

TOP

返回列表