Get folder and file names in batch on Windows

We sometimes need to get the folder or file names in a directory of Windows operating system. It is of course tedious to copy them one by one. The fastest one is using a script to obtain them in batch. Below is the trick.

Create a text file, and put the little snippet (command) below into the text file:

DIR *.* /B >LIST.TXT 

Then, save the text file with a file format (extension) .bat, say, get-file-name.bat.

After that, put the text file to any directory where you want to get file or folder names, and double click it, it runs automatically and generates the result in a new text file: LIST.TXT, which is also located within the same directory.

That is it, simple and efficient.