I suppose the password string contains at least 1 non ASCII character, i.e. a character which has a code value greater decimal 127.
Open a command prompt window and enter chcp
(change code page command). Depending on Windows region and language settings you get displayed that the active code page is code page 850 (Western European country) or code page 437 (North American country) or something different.
The batch file written in a Windows GUI text editor uses most likely a different code page like Windows-1252 (Western European and North American countries).
It is advisable to write a batch file with using same code page as used by Windows for console, or do not use non ASCII characters at all.
But account passwords are something very special. Windows knows that a password for an account is usually entered on GUI using the Windows GUI code page by a user. Therefore a password entered in a console window for an account is automatically converted from OEM code page to Windows (ANSI) code page before encrypting and saving it by Windows.
So the batch file should contain the password string encoded in OEM code page instead of the GUI code page.
For example German umlaut character ä
has code value 228 (hex. E4) using Windows-1252, but has code value 132 (hexadecimal 84) using OEM code page 850. For printing into console window with command echo the German word ähnlich
, it is necessary to write in batch file ä
with code value 132 using OEM code page 850 to get this word correct displayed in console window. It is necessary to write character ä
also with code value 132 into the batch file if this character is used in a password written into a batch file. The password string is automatically converted from OEM to ANSI by command net.