Search code examples
batch-fileencodingcharacter-encodingchar

How to use Polish characters in batch file?


I am writing a batch file to backup my XAMPP folder to One Drive account.

Unluckily my one drive folders name contains Polish char "ł". Executing the below attached batch file script results in creation of new folder rather than transfer of files to One Drive.

I tried chcp but it did not help. I tried saving the batch file using both ANSI and UTF-8 encoding in Programmers Notepad++ but none works.

enter image description here

    @echo on
chcp 852
echo backuping Dataae
cd C:\xampp2\mysql\bin\
mysqldump.exe --user=... --password=... kancelaria > C:\Users\abdel\OneDrive - Mikołaj Kondej\Backup_Kancelaria\%date%_kancelaria_mysql.sql
robocopy C:\xampp2\htdocs "C:\Users\abdel\OneDrive - Mikołaj Kondej\Backup_Kancelaria\%date%" /E
REM forfiles /p "C:\backup" /m "*" /c "cmd /c echo @file" /D -30

timeout 20

:finish

Solution

  • Saving the file in ANSI and adding

    @chcp 1250
    

    solved the problem.