【发布时间】:2015-08-25 16:50:00
【问题描述】:
我正在使用命令提示符中的 echo 在桌面上创建一个 hello_world.txt,这是我的输入。
echo hello world > C:\Users\user\Desktop\hello_world.txt
第一个代码有效,然后我尝试 %userprofile%,如果我想将它提供给另一个用户。
echo hello world > C:\Users\%userprofile%\Desktop\hello_world.txt
不起作用。任何简单的 echo 命令行来创建文本文件?
【问题讨论】:
-
你的
command line是什么? Windows下的Cygwin? cmd.exe? -
如果你习惯了linux shell,你可以安装
git bash。您将拥有快速的所有 linux 命令,并且像echo hello world > C:\Users\user\Desktop\hello_world.txt这样的行将正常工作;) -
你可以尝试通过在命令行中执行 ech %userprofile% 来打印 viariable
%userprofile%
标签: command-line command echo command-prompt