本帖最后由 pcl_test 于 2016-11-10 19:11 编辑
在写一个批处理下载56的视频, 通过网页返回一个XML, 里头包含了一个长字符串
具体文本: http://vxml.56.com/json/MzIwMDg2NjE/?src=out- {"info":{"vid":"32008661","bimg":"http://v155.56img.com/images/6/26/zhssti56olo56i56.com_zhajm_120713452170_b.jpg","textid":"MzIwMDg2NjE","m_download":"y","img":"http://v155.56img.com/images/6/26/zhssti56olo56i56.com_zhajm_120713452170.jpg","key":"bbc43c623c3ddd7fc1a78a545a6e88e1","record":"","tag":"六方位,凯美瑞,凯美瑞六方,,","rela_opera":-4,"sohu_cdn":"0","opera_id":-4,"Subject":"凯美瑞六方位绕车","hd":0,"duration":"1132266","rfiles":[{"filesize":31143899,"totaltime":1132334,"url":"http://f1.r.56.com/f1.c36.56.com/flvdownload/6/26/zhsst@56.com_56flv_zhajm_120713452170.flv?v=1&t=YkNGvtFJpQg9QSl_XmSadw&r=63359&e=1478862265&tt=1132&sz=31143899&vid=32008661","type":"normal","keyframe":""}],"tags":"六方位,凯美瑞,凯美瑞六方,,","user_id":"zhsst","cid":"11","movie":{"m_copyright":"","version":"","keyword":"","class1":"e","last_sub_index":0,"chk_yn":"d","finished":"","coop_vid":"","copyright":"n","total_items":0,"coop":""},"reserveIp":""},"msg":"ok","p2p":1,"segsize":30,"st":1478775865948,"status":"1"}
复制代码 通过- for /f tokens^=1^-31*^ delims^={^,:}^" %%a in (tmp.txt) do (echo %%a %%b %%c %%d)
复制代码 可以分别显示双引号里头的内容 (除了http://.... 被分割两段)
问题是最多只有32组数据, 如果更多数据的话 怎么遍历呢?
另外 使用- @echo off&setlocal EnableDelayedExpansion
- set Text="ABCDEFGHIJKLMNOPQRSTUV[\]^_`abcdefghijklmnopqrstuvwyz{|}~
- set index=1
-
- for /f tokens^=1^-31*^ delims^={^,:}^" %%A in (tmp.txt) do (
- for /l %%1 in (1 1 31) do (
- set pChar=%Text:~!index!,1%
- echo %%!pChar!
- set /a index+=1
- )
- )
复制代码 并不能遍历所有的变量....
怎么才能针对一个长字符, 遍历里头所有的列呢? 求教各位高手.... |