You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows批处理中arangoexport的--custom-query-bindvars参数JSON格式报错求助

Windows批处理中arangoexport的--custom-query-bindvars参数正确写法

你遇到的问题核心是两点:JSON格式不合法 + Windows批处理(CMD)的引号转义规则不匹配。以下是解决方法:

错误原因分析

  1. JSON规范要求键和字符串值必须使用双引号,你之前用单引号的写法({'myvarname': 'myvalue'})本身就不符合JSON格式。
  2. Windows CMD对引号的解析逻辑特殊,直接传递带双引号的JSON字符串时,需要正确转义,否则会被CMD截断或解析错误。

正确写法

写法一:直接在批处理中转义双引号

用^转义JSON内部的双引号,同时用双引号包裹整个参数:

arangoexport ^
  --custom-query-file myAQLfile.aql ^
  --custom-query-bindvars "{^"myvarname^": ^"myvalue^"}" ^
  ...

写法二:通过文件传递bindvars(推荐,避免转义麻烦)

如果bindvars结构复杂,建议将JSON写入单独文件:

  1. 创建bindvars.json文件,内容为合法JSON:
{"myvarname": "myvalue"}
  1. 批处理中通过@符号引用该文件:
arangoexport ^
  --custom-query-file myAQLfile.aql ^
  --custom-query-bindvars @bindvars.json ^
  ...

这种方式不需要处理任何转义,适用于所有复杂场景。

内容的提问来源于stack exchange,提问作者Frank Leverenz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 15:04:54