Topic "WinSCP.com control via parent process through pipes"

Author Message
lew
[View user's profile]

Joined: 2013-08-26
Posts: 3
Location: Berlin / Germany
Hi Martin & the WinSCP community,

first of all I would like to express my special thanks to you, Martin, for providing such a great tool to the public. WinSCP is very useful and makes our (file-transfer-) lives easier.

To run WinSCP.com scripted is a good thing, but not enough for me. I want to use WinSCP 5.2.3 beta's file transfer capabilities to automatize some more sophisticated tasks. To do this I wrote a C program that launches WinSCP.com as a child process (via CreateProcess) and creates some anonymous pipes. These pipes are connected to WinSCP.com's stdout and stdin. It works, the main program can read WinSCP's output and can command it.

But it can not switch off batch mode. The main program sends batch off to WinSCP, WinSCP confirms that and ignores it! It behaves like it would run a script. It decides to answer user questions automatically in a way I don't want. I did all the work with the C main program to have the control (like a human user of WinSCP.com would have) to implement a more complex logic than a WinSCP script can have.

Is this a bug or a feature? How does WinSCP even know it is run by a program and not by a user? Does WinSCP observe its stdout and stdin handlers and switch automatically and forcibly to batch mode if there is no standard shell connected to the handlers?

Could you enable to control WinSCP.com from a parent process via stdin and stdout completely? This would be fantastic!

Best regards,
Lew
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Yes, the winscp.com behaves differently when its stdin/stdout are pipes or files (rather than a console).
Of course, you can alter the console/Main.cpp to change this.
Alternatively (though that's a lot of work) you can replace the winscp.com completely and interact with winscp.exe directly (like WinSCP .NET assembly does).

Last edited by martin on 2013-08-30; edited 1 time in total
lew
[View user's profile]

Joined: 2013-08-26
Posts: 3
Location: Berlin / Germany
Hi Martin,

thank you very much for pointing out that console/Main.cpp is the place to adapt the code to my needs. That saves me work and time.

Best regards,
Lew
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License