我正在使用命令提示符中的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命令行来创建文本文件吗?
您的命令应为:
echo hello world > %userprofile%\Desktop\hello_world.txt
如果您在前面放了任何东西%userprofile%
,那是行不通的,因为这是一条完整的路径,因此C:\Users\%userprofile%\Desktop\hello_world.txt
将替换为C:\Users\C:\Users\cromix\Desktop\hello_world.txt
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句