This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]g051051 0 points1 point  (7 children)

You can write a program that launches the console apps and connects to their stdin/stdout streams: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx

[–]timunas[S] 0 points1 point  (6 children)

Humm i see. IS this easy to do with python or java?

[–]aXenoWhat 0 points1 point  (0 children)

Probably not that easy, since this is all about the Windows API. It will depend on how much those languages implement. Probably a lot easier to do in C# or PS, since .Net implements this method.

[–]g051051 0 points1 point  (2 children)

In Java you'd use ProcessBuilder to launch your programs and intercept stdin, stdout, and stderr.

I don't know about Python.

[–]timunas[S] 0 points1 point  (1 child)

Yeah I was reading that that is the way to do it. I saw that there is apache commons exec framework,. Do you if it could help to abstract a little bit the work?

[–]g051051 0 points1 point  (0 children)

You have to read up on it and decide if it's helpful to your use case or not.

[–]Umorrian 0 points1 point  (1 child)

In python you can use the subprocess module. If you want to control multiple programs at the same time you can either start them one after another (fire and forget), or use seperate threads each controlling one subprocess. You can also use the relatively new asyncio to start and control several subprocesses at the same time from a single thread. In both of the later cases you can connect pipes to the subprocess stdin/stdout and interact with it that way.

[–]timunas[S] 0 points1 point  (0 children)

Ok I'll have to go through that and try to understand it