Summary of echo usage of DOS command

I have talked about some basic file operation commands in DOS before, see Basic DOS commands --- 2. Basic file operation commands_Justinhhhh的博客-CSDN博客

This blog mainly summarizes the echo command:

1. echo string

echo + string can output the string to the screen

Such as

echo The world is very well

2. Echo string> file name. extension

Echo string> file name. The extension can input the string into the specified file.

  • But if there is something in the modified file, the command will overwrite the original content with the new content, that is, rewrite, such as
echo I want to be your huaband > qingshu.txt

 

  • If the file does not exist, it will be created automatically, such as
echo I love you so much > huifu.txt

3. echo string >> file name. extension

echo string >> file name. The extension can input the string into the specified file.

  • If there is content in the file, this command is append. Such as
echo I want to be your huaband >> huifu.txt

  • If the file does not exist, it will also be created automatically.

to sum up:

Echo can output a string to the screen or to a file, and can be rewritten or appended.

But it should be noted that the echo command can only output a single-line string. If you want to enter multiple lines in the file, one method is to use the echo appended form to input one sentence by one sentence, but this is very troublesome, and another method The copy command is used, see also

Basic DOS commands-2. Basic file operation commands_Justinhhhh's blog -CSDN blog

 

Guess you like

Origin blog.csdn.net/Justinhhhh/article/details/112553579