WinSCP.com control via parent process through pipes

Advertisement

lew
Joined:
Posts:
2
Location:
Berlin / Germany

WinSCP.com control via parent process through pipes

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,468
Location:
Prague, Czechia

Re: WinSCP.com control via parent process through pipes

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

Reply with quote

lew
Joined:
Posts:
2
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

Reply with quote

Advertisement

You can post new topics in this forum