Board logo

标题: [文本处理] cmd中可以执行的curl命令在dos中却返回错误的结果,求大神帮忙看下 [打印本页]

作者: fu7100    时间: 2017-12-19 11:44     标题: cmd中可以执行的curl命令在dos中却返回错误的结果,求大神帮忙看下

在cmd命令行中执行如下curl命令返回结果正确.
curl -s "http://172.17.3.100:81/base/image/detect?appid=test&token=fc18b32ad40c1c52187b565a5357383a&url=%2fbimg%2fLOC%3a03%2fdata_60%2f20170714%2f00%2f2ebd1b4a8e42be0630141858629f4778_1"


执行结果

D:\test>curl -s "http://172.17.3.100:81/base/image/detect?appid=snface&token=fc18b32ad40c1c52187b565a5357383a&url=%2fbimg%2fLOC%3a03%2fdata_60%2f20170714%2f00%2f2ebd1b4a8e42be0630141858629f4778_1"
{"code":200,"message":"鎴愬姛","data":{"digest":"FaceDetectResult_5603817337a2c1a891b37d016f6768ab","url":"/bimg/LOC:03/data_60/20170714/00/2ebd1b4a8e42be0630141858629f4778_1","faceinfo":[{"rect":{"left":37,"top":53,"right":103,"bottom":120,"confidence":99},"index":0,"attribute":{"age":32,"attractive":-1,"eyeGlass":0,"gender":0,"smile":-1,"sunGlass":0},"url":"/bimg/LOC:03/data_60/20170714/00/2ebd1b4a8e42be0630141858629f4778_1"}]},"status":"SUCCESS"}

将上面的命令放到bat脚本中执行则报错

@echo off
setlocal enabledelayedexpansion
curl -s "http://172.17.3.100:81/base/image/detect?appid=snface&token=fc18b32ad40c1c52187b565a5357383a&url=%2fbimg%2fLOC%3a03%2fdata_60%2f20170714%2f00%2f2ebd1b4a8e42be0630141858629f4778_1"
pause


执行结果
{"code":501,"message":"鍥剧墖鏈嶅姟鍣ㄥ紓甯?,"data":null,"status":"ERROR"}
请按任意键继续. . .
作者: fu7100    时间: 2017-12-19 18:18

哪位大神能处理这个问题呀,  感激不尽!
作者: slore    时间: 2017-12-20 22:35

%要转义写成%%




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