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
You need your batch file to generate a
.vbs script like this:
Set oShell = CreateObject ("Wscript.Shell")
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: