5
I am trying to create a Batch (CMD) in Windows that "sweeps" folders in a particular directory and then renames the sub-folders according to a criterion I set.
I am using the code below to carry out the operation (detail: this code I found on the internet and made some small adjustments).
FOR /D %%D IN (C:\Users\meuUsuario\Desktop\Music\*) DO CALL :RENAME "%%D"
pause
:RENAME
SET CRITERIA=\"(Músicas)"
FOR /D %%R IN (%1%CRITERIA%) DO RENAME %%R "(Singles)"
If I change my criteria to a folder that the nomenclature does not accentuate, it works normally.
I’ve been able to fix this for a while, but it’s hard...
Edit the script on CMD itself. You are probably saving the file in the wrong encoding. Give a
type meuarquivo.bat
and see if it is appearing right to check if the accent is correct in the CMD.– Bacco
@Bacco I understood yes and it makes sense. I did the "type" and the accent appeared "bugada" really... How do I edit the script or create one by CMD instead of Notepad? Edit "myBat.bat" didn’t work...
– Antônio Filho
Don’t have a code editor there? Several of them allow you to choose the encoding when saving. You could use a
copy con arquivo.bat
and type in the console itself, but it is infernal to correct typos :)– Bacco
@Bacco I created the script by Notepad++ (selecting the Batch language). I also tried to create it by Notepad and saved it in 3 different enconding keys. All the accents were buggered.
– Antônio Filho
try to use encoding
Character Sets > Western European > OEM 850
NP++ - To find out which is the correct encoding, enter the CMD and typechcp
[enter]– Bacco
@Bacco Solved! That’s right! 850. I saved by NP++ and it worked perfectly. Thank you!
– Antônio Filho