One Line Code

Export file/folder names in selected directory

dir \\?\%1 /a:-d /b /o /p /w >FileList.txt

or

dir \\?\%1 /a /b /o >FileList.txt

Decoding:

dir
# Displays a list of a directory's files and subdirectories.
\\?\%1
# show the full path in the select directory

Note: 
question mark (?) is the wildcard character, which matches any single character.

%1 
# the first parameter
Similarly, %9 is the ninth parameter, %* is the any parameters starting from the 1st parameter

In addition, %0 is the self file
/a:-d
# Displays without the names of those directories.

If you don't use this parameter, the command (/a) displays the name of all files except hidden and system files.
/b
# Displays a bare list of directories and files, with no additional information.
/o
# lists the directories alphabetically

/o[:]
n - Alphabetically by name (/o:n)
e - Alphabetically by extension
g - Group directories first
s - By size, smallest first
d - By date/time, oldest first
Use the - prefix to reverse the sort order
/p
# Displays one screen of the listing at a time.
/w
# Displays the listing in wide format, with as many as five file names or directiotry names on each line.
>FileList.txt
# Export the output to FileList.txt

If use >>, then append the output.
updatedupdated2020-06-182020-06-18