How to use Polish characters in batch file?

Viewed 664

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
2 Answers

Saving the file in ANSI and adding

@chcp 1250

solved the problem.

I ran into a similar problem awhile back when trying to use IPA characters, and I was able to fix it using chcp 65001 right below my @echo off. This should allow you to use any character in Unicode, however I haven't tested it with recent additions to Unicode such as because my computer has yet to update to support it (link is the character if yours doesn't support it either and you want to see it).

Related