Is this possible to write list of file names into

2019-03-17 22:51发布

问题:

I want to write the list of file names from a Given directory path in to text file whenever clicking a windows XP batch file.I don't know whether it is possible or not in Windows Xp?

So,Can u please enlighten me on this?

回答1:

How about something like this?

dir /b "C:\My Path" > myFiles.txt


回答2:

In a detailed way

@echo off
Rem Following command will write the names of all files in a text file
dir "C:\Source folder" > C:\destination.txt
echo "File names have been written"


回答3:

If you want to list down all the file names with other details like time/size etc and no other directory information, you can use the below command

DIR c:\temp\*.* | FIND ":" > logfile.txt

This will obtain a bare DIR format (no heading or footer info) but retain all the details, pipe the output of DIR into FIND.
This assumes that your date time stamp separator is : (e.g. 09-04-2018 11:06).