Command line 在命令提示符下使用echo创建文本文件
我正在桌面上使用echo命令提示符创建hello_world.txt,这是我的输入Command line 在命令提示符下使用echo创建文本文件,command-line,command,echo,command-prompt,Command Line,Command,Echo,Command Prompt,我正在桌面上使用echo命令提示符创建hello_world.txt,这是我的输入 echo hello world>C:\Users\user\Desktop\hello\u world.txt 第一个代码有效,然后我尝试%userprofile%,例如,如果我想将它提供给另一个用户 echo hello world>C:\Users\%userprofile%\Desktop\hello\u world.txt 不起作用。任何创建文本文件的简单echo命令行?您的命令应该是: echo he
echo hello world>C:\Users\user\Desktop\hello\u world.txt
第一个代码有效,然后我尝试%userprofile%,例如,如果我想将它提供给另一个用户
echo hello world>C:\Users\%userprofile%\Desktop\hello\u world.txt
不起作用。任何创建文本文件的简单echo命令行?您的命令应该是:
echo hello world>%userprofile%\Desktop\hello\u world.txt
如果将任何内容放在
%userprofile%
之前,则不起作用,因为这是一个完整路径,因此C:\Users\%userprofile%\Desktop\hello\u world.txt
将替换为C:\Users\cromix\Desktop\hello\u world.txt
您可以键入:
触摸
非常重要注意:您只能在cmder或Mac OS上使用此命令
这在Windows中运行,只需下载
您的
命令行是什么?窗户下的Cygwin?cmd.exe?如果您习惯于linux shell,您可以安装git bash
。您将拥有所有的linux命令,像echo hello world>C:\Users\user\Desktop\hello\u world.txt这样的行将正常工作;)您能否在命令行中执行ech%userprofile%来打印变量%userprofile%