No you cannot prevent winscp.com from changing console window title.
Note that a console window title is changed by winscp.com only, whose sole purpose is that it is a console application. As a console application, it inherits a console of the parent console application (if any), like that of cmd.exe, when executed from a batch file. Then it can write its output to it, instead of opening a separate console window, what would otherwise equivalent winscp.exe /console call do (winscp.exe is GUI application, so it cannot inherit a console window of parent process). Read about WinSCP executables.
But you seem to want to prevent users from seeing the output of winscp.com too. You only abuse the (hidden) output for error checking. That's not a very reliable approach. You better use WinSCP exit code to check for errors. See How do I know that script completed successfully? If you need even more detailed error checking, you can use XML logging.
Once you get rid of your abuse of WinSCP output, you can switch to winscp.exe with the same arguments. When winscp.exe is called with /command switch, but without /console switch, it runs the commands completely silently (and it does not change console title).
Though for such a complicated use, you should switch from plain WinSCP scripting to WinSCP .NET assembly and PowerShell. Your code will be way cleaner and more robust.
For a quick solution, you can run winscp.com in its own hidden console.
See Run a batch file in a completely hidden way.
(though contrary to most examples, you want to set the bWaitOnReturn argument to True).
You need your batch file to generate a .vbs script like this:
Set oShell = CreateObject ("Wscript.Shell")
Dim strArgs
strArgs = "cmd.exe /c ""C:\some\path\winscp.com"" /ini=nul /script=temp.ftp ftp://username:password@host > output.txt"
oShell.Run strArgs, 0, true
And then run it from the batch file like:
cscript runwinscp.vbs
:fileman), I handle the results of thelscommand to get a list of file names without downloading all the files. Is there a way to runwinscp.exe /commandand send output to a text file? – Mark Deven Dec 21 '18 at 18:34msxsl(as you can see in the linked article) - though indeed doing such complex scripting in a batch file is not a good idea. – Martin Prikryl Dec 21 '18 at 18:41bWaitOnReturnin the past – Mark Deven Dec 21 '18 at 20:01bWaitOnReturnin this script? It's not working with theoShell.Run. Thanks for your patience. – Mark Deven Dec 22 '18 at 19:39trueis already there in my answer:oShell.Run strArgs, 0, true– Martin Prikryl Dec 22 '18 at 20:43Dim strArgs strArgs = "cmd.exe /c ""C:\Users\theBATeam\Documents\Batch\FTP-Chat\Bin\winscp.com"" /ini=nul /script=""C:\Users\theBATeam\Documents\Batch\FTP-Chat\Bin\temp.ftp"" ftp://username:pass@ftp.address.com > getWelcome.txt" oShell.Run strArgs, 0, true ``` isnt working for me. Any ideas why? The output into getWelcome.txt is blank, and it doesn't seem to execute anything since no files are downloaded or uploaded.– Mark Deven Dec 24 '18 at 13:16cmd.exeis very strange. Remove the quotes aroundC:\Users\theBATeam\Documents\Batch\FTP-Chat\Bin\temp.ftp. – Martin Prikryl Dec 24 '18 at 13:22Dim strArgs strArgs = "cmd.exe /c """"C:\Users\theBATeam\Documents\Batch\FTP-Chat\Bin\winscp.com"" /ini=nul /script=""C:\Users\theBATeam\Documents\Batch\FTP-Chat\Bin\temp.ftp"" ftp://username:pass@ftp.address.com"" > getWelcome.txt– Martin Prikryl Dec 24 '18 at 13:24