List all the file names from a folder and write out to a txt file keeping the special characters using cmd

Viewed 37

I need to write out file names from a folder (subfolder) to txt but i also need to keep the special characters like for example: öüóőúéáű (hungarian) as well. I 've tried this:

dir /s /b > filenames.txt

but it is not work this time. Can you help me? Thank you!

1 Answers

This batch can did the trick using the code page chcp 65001 :

@echo off
chcp 65001>nul
dir /s /b>filenames.txt
start "" /MAX filenames.txt
Related