Basic DOS commands---2. Basic file operation commands

0. Clear screen:

cls

1. View the files in the current path:

dir

Effect picture:

2. Output the string to the screen:

echo + 字符串 :输出该字符串到屏幕上
如:echo the world is very well

Effect picture:

3. Output the string to the file:

echo + 字符串 + > + 文件名.扩展名:输出该字符串到制定文件中
如:echo the world is very well > qingshu.txt

Effect picture

4. Browse file content

type + 文件名.扩展名:浏览指定文件中的内容
如:type qingshu.txt

Effect picture:

  • If the content of the file you want to view exceeds one page, you can view it in pages:
type + 文件名.扩展名 + | + more (将内容分页显示)
如:type qingshu.txt | more 

 After displaying the first page, press "Space" to turn pages;

  • If there are many files in a path, you can also use the "| more" command if you want to view them in pages.
dir + 路径 + | + more (将内容分页显示)
如: dir c:\windows | more 

 5. Insert multiple lines of content into the file:

copy con + 文件名.扩展名 + 回车 + 输入内容 + "ctrl+z" 结束输入
如: copy con yaoqing.txt
     I love you
     So much
     So that I want to be your husband

 

6. Delete files

del 文件名.扩展名   
如:del qingshu.txt    (删除qingshu.txt 文件)

del *.txt 删除当前目录下所有的txt 文件

del *.* 删除当前目录下所有类型的文件

7. Modify the file name 

ren 原文件名.扩展名 新文件名.扩展名
如: ren qingshu.txt dani.txt

 

Guess you like

Origin blog.csdn.net/Justinhhhh/article/details/112528286
Recommended