Try saving this as a .reg file and running it:
| Text |
1
23
45
67
| Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Here]
@="Command Here"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Here\Command]@="cmd.exe /k pushd %1" |
This will present a "Command Here" entry on your context menu whenever a directory is right clicked.
Then after selecting "Command Here", at the command prompt, enter
| Text |
1
| dir /o /b >filename.txt |
This will do a bare, sorted dir and write the result to filename.txt.