My only idea is that you are a victim of file system redirection (as this is about directory that normal account does not have a write access to).
If you run WinSCP (under the same local account as you run the script) and open the
If you run WinSCP (under the same local account as you run the script) and open the
C:\Program Files (x86)\WinSCP\script.txt
in its internal editor, does the file look the same?