批处理文件 |传递/管道字符串并用双引号分隔(“)

问题描述 投票:0回答:0

在批处理文件中,如何传递 / 管道字符串并用双引号 (") 拆分它

例子 |我得到的问题输出

:: Pass / Pipe string and split by double quote(")
:: Dont work
echo "hello":"World!" | FOR /F delims^=^: %F IN ('more') DO @echo %F
: was unexpected at this time.

echo "hello":"World!" | FOR /F delims^=^" %F IN ('more') DO @echo %F
" %F IN ('more') DO @ echo %F   was unexpected at this time.

:: Work but not what I need.
FOR /F delims^=^" %F IN ('echo "hello":"World!"') DO @echo %F
hello

在这里尝试的示例副本

:: Dont work
echo "hello":"World!" | FOR /F delims^=^: %F IN ('more') DO @echo %F 
echo "hello":"World!" | FOR /F delims^=^" %F IN ('more') DO @echo %F 
:: Work but not what I need.
FOR /F delims^=^" %F IN ('echo "hello":"World!"') DO @echo %F
for-loop parsing batch-file split pipe
© www.soinside.com 2019 - 2024. All rights reserved.