想知道批处理命令是否可以进入json文件并设置值。例如,Json File
{ "JsonSample" : [{
"Field1": %Value From Batch Command%,
"Field2": %Value From Batch Command%
}]}
答案 0 :(得分:0)
您可以使用Xidel来做到这一点:
SET var1=Value1
SET var2=Value2
xidel.exe -s -e "{'JsonSample':[{'Field2':'%var1%','Field2':'%var2%'}]}"
{
"JsonSample": [
{
"Field2": "Value1",
"Field2": "Value2"
}
]
}
要将其另存为json,只需重定向到文件:
xidel.exe -s -e "{'JsonSample':[{'Field2':'%var1%','Field2':'%var2%'}]}" > output.json