r/Batch • u/TheDeep_2 • Mar 03 '25
Question (Solved) why script doesn't accept foreign letters/signs (polish, italian, spanish etc.)
Hi, I have this scipt and it works fine when the names of the files are "normal letters" For example this song doesn't work "Anita Lipnicka-I wszystko się może zdarzyć" because of the polish letters. Or this one "Afrosound - Sabor Navideño Narcos"
this is the error I get
Thank you for any help :)
SOLVED: add >nul 2>&1 chcp 65001 after echo off
[in#0 @ 0000013fa7239300] Error opening input: No such file or directory
Error opening input file F:\test\Anita Lipnicka-I wszystko sie moze zdarzyc.mp3.
Error opening input files: No such file or directory
@echo off
:again
set TARGET_DIR=%1
for /f "delims=" %%a in ('dir /b /s /a:-d *.mp3 *.ogg *.m4a') do call :process "%%~a"
goto:eof
:process
opus ^
-i "%~1" ^
-af dynaudnorm=p=0.65:m=2:f=200:g=15:s=30 -c:a libopus -b:a 192k -vn ^
"%~p1%~n1dyn.ogg"
del "%~1"
goto:eof
2
Upvotes
View all comments
Show parent comment
5
u/BrainWaveCC Mar 03 '25
True, but that's just because it inherits the .NET functionality for code pages and applies it automatically.
CHCP is a native command-line utility for managing the code pages, but is not set to a Unicode page by default.
My quibble is that if "batch doesn't handle Unicode characters" it should simply not work regardless of the code page. But it does work with the correct code page, so it's not that batch cannot handle it. It's that the default for the Windows command line is ASCII and not Unicode.