【发布时间】:2016-08-02 13:44:49
【问题描述】:
正如这里所说的Is it possible to set an environment variable to the output of a command in cmd.exe 我一直使用它
mycommand.exe>%TEMP%\out.txt
set /P FOO=<%TEMP%\out.txt
但这很丑,因为它会创建一个文件。
for 方法更好但复杂
我想要一些简单的 la unix,比如:
mycommand.exe|set /P FOO=
没有错误,但是在我运行之后没有设置FOO。
为什么这不起作用?
【问题讨论】:
-
解释见this post
标签: windows batch-file environment-variables