在dos/windows中隐藏jq的状态输出

Met*_*450 5 json curl batch-file jq

我正在使用curl for windows(http://www.confusedbycode.com/curl/)与jq(http://stedolan.github.io/jq/)一起通过批处理文件与web api进行交互.我遇到的看似简单的问题是无论我做什么,我都无法抑制JQ的"状态"输出.特别是,它总是输出"进度状态",如:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
100   116  100    99  100    17    908    155 --:--:-- --:--:-- --:--:--   908
Run Code Online (Sandbox Code Playgroud)

简化的示例批处理文件将是:

@echo off
@curl.exe -H "Content-Type: application/json" -d '{\"cmd\":\"login\"}' http://localhost:80/json | jq -r .session > sess.txt
Run Code Online (Sandbox Code Playgroud)

请注意,jq确实按预期运行 - 我只需要让它以静默方式运行.它似乎忽略了@echo,我在手册中找不到任何开关来禁用此输出.

有任何想法吗...?

非常感谢提前:)

小智 15

curl --silent
Run Code Online (Sandbox Code Playgroud)
-s, --silent
  Silent or quiet mode. Do not show progress meter or error messages. Makes Curl
  mute.