Here I have created a folder with name "test" containing 20 other txt files whose names I want to store in another file. So follow these steps:
1. Go to the directory where the files are placed, in my case it's "test" folder.
2. Hold "Shift" key and right click anywhere on blank screen, select "Open command prompt here".
3. Enter the command as below,
dir /b /o:n >filenames.txt- Replace filenames.txt with any name you want as output file.
5. If you want to store all file names with their directory links, just enter following command,
dir /b /o:n /s >filenames.txt
Note: You can create the file with any format, such as to create .pdf file with all file names in specific directory, just replace filenames.txt with filenames.pdf