简体   繁体   中英

Create a batch file that reads all the text files contained in current directory

The essence of the task in the description, so far I have a code reading the file. But the cycle can not be put into a loop in batch

@ECHO OFF

for /f "tokens=* delims=" %%x in (text1.txt) do echo %%x

PAUSE

It's simpler than that:

@ECHO OFF
FOR %%A IN (*.txt) DO ECHO %%A
PAUSE

Edit

To satisfy your more clear requirement then just use this:

@ECHO OFF
TYPE *.txt
PAUSE

Thank CuprumBur for answer from ru.stackoverflow.com

@echo off
chcp 1251
for  %%f in (*.txt) do (
type %%f
echo.
)
pause

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM