相当于 Bash 反引号的批处理 [英] Batch equivalent of Bash backticks
本文介绍了相当于 Bash 反引号的批处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 Bash 时,我可以将一个命令的输出放入另一个命令中,如下所示:
When working with Bash, I can put the output of one command into another command like so:
my_command `echo Test`
和
my_command Test
(显然,这只是一个不实际的例子.)
(Obviously, this is just a non-practical example.)
我只是想知道您是否可以在 Batch 中做同样的事情.
I'm just wondering if you can do the same thing in Batch.
推荐答案
您可以通过首先将输出重定向到文件来实现.例如:
You can do it by redirecting the output to a file first. For example:
echo zz > bla.txt
set /p VV=<bla.txt
echo %VV%
这篇关于相当于 Bash 反引号的批处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文