通过批处理文件打印目录中的所有文件 [英] Print all the files inside a dir through batch file

查看:359
本文介绍了通过批处理文件打印目录中的所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在DOS中编写一个批处理文件,该文件将从输入目录中读取所有文件,并使用FOR循环在屏幕上显示文件列表.

I want to write a batch file in DOS which reads all the files from the input directory and display the list of files on the screen using FOR loop.

推荐答案

dir用于目录中的文件

dir /s,如果要在子目录中包含文件.

dir /s if you want to include the files in the sub-directories.

FOR %%i IN (*.*) DO echo %%i

这将打印出您在其中运行批处理文件的目录中所有文件的名称.

This will print out the names of all the files in the directory you run the batch file in.

这篇关于通过批处理文件打印目录中的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆