You get this error message, when you try to execute a script that does not use a valid UTF-8 (or UTF-16) encoding.
Older versions of WinSCP used legacy ANSI encoding, when the script file does not have UTF-8 (or UTF-16) byte order mark (BOM). The recent versions of WinSCP default to UTF-8 encoding, when no BOM is present. If you have a script written in ANSI encoding for an old version of WinSCP, you have to convert it to UTF-8 (or UTF-16) encoding, when upgrading to a recent version of WinSCP.
A simple way to convert the script encoding is:
- Open the script in Notepad;
- Go to File > Save As;
- Change Encoding from ANSI to UTF-8;
- Click Save.