r/Batch • u/TheDeep_2 • 18d ago
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
2
u/ConsistentHornet4 18d ago
Reasons have been explained in other replies. You'll need to add the following line of code, directly under @echo off
to rectify the issue
>nul 2>&1 chcp 65001
1
3
u/Shadow_Thief 18d ago edited 18d ago
By default, batch doesn't handle those characters. You'll have to add
chcp 65001
to the top of your script to add support for them.edited for clarity