Search code examples
windowsbatch-filecharacterspecial-charactersdirectory

Windows Folders with Special Character, how to handle them on a loop


I have this shared folder,

\\FILE48\BUGB-MONTR‚AL_RŠGLEMENTS_GESTIONNAIRES

After activating chcp 1252

\\FILE48\BUGB-MONTRéAL_RèGLEMENTS_GESTIONNAIRES

I want to create a script which should be able to read a file, which contains that folder and handle it. Currently I am not able to work on this,

for example I have a file : file1.txt

\\FILE48\BUGB-MONTR‚AL_RŠGLEMENTS_GESTIONNAIRES

doing a for /f %%i in (file1.txt) do diruse %%i doesn't work.

The output of my script attempts to reach \FILE48\bugb-Montr‚al_RŠglements_Gestionnaires

not sure why.


Solution

  • I ended up using: iconv -f utf-8 -t Windows-1252 < input >output After this the text, strings started to work ok.