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
It’s a chat program. An assignment. – Mark Deven – 2018-12-21T16:42:12.890
Just it changes the title. I handle the output. – Mark Deven – 2018-12-21T16:42:46.247
You can look at it and see... – Mark Deven – 2018-12-21T16:43:02.527