Windows - A batch file to list files excluding the subfolders

Ask a question


I need a batch file to list files stored in a folder but without the ones present in the subfolders?


Try this:
for %%i in (Y:\Files\*.*) do echo %%~ni >> D:\List_of_files.txt

To have a sorted list (alpahabetically).
for %%i in (Y:\Files\*.*) do echo %%~ni | sort >> D:\List_of_files.txt

Error message - C:\progam1\mywebs~1\bar\2.bin\m3plugin.dll
Laptop - Print Screen key stopped working