You are using 10 years old version of WinSCP (4.2.7). Please upgrade to the latest version and post a new log file. And show us how exactly are you running WinSCP script.
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
option echo onin your script (but your question does not show that).
/log=C:\path\to\winscp.logcommand-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
winscp> option batch abort
winscp> option confirm off
winscp> open sftp://acct:pass@sFTP.thedomain.com:22
Searching for host...
Network error: Connection timed out.
Searching for host...
Connecting to host...
Using username "username".
Starting the session...
Active session:  firstname.lastname@example.org
usernamein the output?
Version of WinSCP you are using (you should be using the latest version if possible).
If the problem started to occur after upgrade, mention the last version of WinSCP which was working for you.
Version of Microsoft Windows you are running WinSCP on.
Transfer protocol (SFTP, FTP, SCP, WebDAV or S3).
Mention if you use GUI or scripting/automation. If you use GUI, specify interface style you are using (Commander or Explorer).
If you experience an error, include full error message. You may use Ctrl+C to copy the message, then paste it (Ctrl+V) to the post. Also check list of common error messages.
Try to describe precise steps that lead to the problem (where do you click, what keys do you press, what do you see, etc.). If you are not able to reproduce the problem with the steps, it is probably not worth to report it as I will not be able to reproduce it (and solve) too.
Particularly, if the problem relates to user interface, consider recording your steps or even full video. E.g. using Steps Recorder in Windows 7 or newer2 or Start recording function of Game bar in Windows 103 or Recordit or similar service.
If your problems relates to interaction with remote server, please post a full log file showing ...
For scripting/automation-related issues, include your full script, command-line you use to run WinSCP, and output you see on WinSCP console.