密钥i在Windows中运行的命令(mycommand
),它返回上一个JSON文件i执行以下操作提取特定字符串基于从JSON文件
<mycommand> | findstr /r InstanceId >instance.txt
返回"InstanceId": "i-59df8e93",
作为输出。现在我想要做的是我只想要在InstanceId:
之后和,
之前的部分。
如何在Windows命令提示符下执行该操作?
编辑1:我已经取得了进展到这里,Instance1.txt的
内容:
"InstanceId": "i-59df8e93"
我用下面的命令:
FOR /F "tokens=1,2,3 delims=:" %G IN (instance1.txt) DO @echo %G %I> instance1.txt
它返回"InstanceId"
我想这两个令牌在不同的变量。所以我可以提取i-59df8e93
。如何进行 ?