create a list of files and folders inside of a folder via cmd and outputting it in a .txt

Solution 1:

dir/a/b/s path\to\folder > Desktop\files.txt

(Remove /a if you don't want to list "hidden" files.)

Alternatively,

tree/f > Desktop\files.txt