找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 26766|回复: 6

[其他] 【已解决】批处理怎样实现多个内容同时筛选查找?

[复制链接]
发表于 2015-7-2 08:23:06 | 显示全部楼层 |阅读模式
本帖最后由 chouxia 于 2015-7-20 08:29 编辑
  1. curl www.baidu.com |find /i "ok" >nul
复制代码
用这个可以判断网页内容中是否有ok
errorlevel也正确
现在需要查找另外一段内容,需要在一行代码中实现!请问如何操作?
举例,在curl的回显中需要再find一个"none"
应该怎么操作?
发表于 2015-7-2 09:05:02 | 显示全部楼层
  1. curl www.baidu.com | findstr /i "ok none"
复制代码
 楼主| 发表于 2015-7-2 09:46:09 | 显示全部楼层
DAIC 发表于 2015-7-2 09:05



    我现在既需要ok的返回页需要none的返回啊
发表于 2015-7-2 16:41:28 | 显示全部楼层
回复 3# chouxia


    请把2楼代码的实际结果和你希望的结果分别发出来看看有何差异
 楼主| 发表于 2015-7-2 17:18:30 | 显示全部楼层
这个是curl的返回值
<pre class='xdebug-var-dump' dir='ltr'>
<b>array</b> <i>(size=2)</i>
  'hash' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#
cc0000'>'lj5Q5ofZG4z7ghrwTJHhIgiVIc5f'</font> <i>(length=28)</i>
  'key' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#c
c0000'>'lj5Q5ofZG4z7ghrwTJHhIgiVIc5f'</font> <i>(length=28)</i>
</pre>HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Date: Thu, 02 Jul 2015 00:46:49 GMT
Server: Apache/2.4.9 (Win64) PHP/5.5.12
X-Powered-By: PHP/5.5.12
Set-Cookie: PHPSESSID=lutmp9i5ve5qsa32i78bopak53; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 73
Content-Type: text/html
error http://............
现在需要find HTTP/1.1 200 OK
还要find error http://.
发表于 2015-7-2 17:51:38 | 显示全部楼层
回复 5# chouxia
  1. curl www.baidu.com | findstr "OK error"
复制代码
发表于 2015-7-8 16:28:22 | 显示全部楼层
我今儿也在玩CURL, 你是要取CURL的HTTP状态码么
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-19 01:16 , Processed in 0.018816 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表