28 windows command-line batch-file
如何在Windows批处理文件中执行以下操作?
%cd%/subdir?)请注意,我想将此作为批处理脚本的一部分,因此我不能使用con+ Enter(至少,也许我可以,但我不知道如何模拟Enter作为批处理脚本的一部分).
谢谢!
gra*_*ity 52
使用输出重定向>和>>
echo one>%file%
echo two>>%file%
echo three>>%file%
Run Code Online (Sandbox Code Playgroud)
或者以更易读的方式:(在cmd.exe,使用" echo one >%file%"将包括之前的空格>.)
>%file% echo one
>>%file% echo two
>>%file% echo three
Run Code Online (Sandbox Code Playgroud)
你也可以使用:
(
echo one
echo two
echo three
) >%file%
Run Code Online (Sandbox Code Playgroud)
echo Line 1^
Line 2^
Line 3 >textfile.txt
Run Code Online (Sandbox Code Playgroud)
Note the double new-lines to force the output:
Line1
Line2
Line3
Run Code Online (Sandbox Code Playgroud)
Also:
(echo Line 1^
Line 2^
Line 3)>textfile.txt
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
84456 次 |
| 最近记录: |