Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all ,
I face a problem about the standard redirection of input& output about cmd.exe . my exepcted process like below :
1) Manually run a cmd.exe (we can called it DestinationCMD here)instance .
2 Using our own app send commands to DestinationCMD.(e.g. ping 127.0.0.1)
3 Our own app auto-get the output from DestinationCMD when STEP2's job finish running.

NOTE: we can not programmatically running the cmd instance in STEP1;the whole process is indeed to communicates with an existed cmd which we manually startup at the begining. So i don't know how to redirect the input and output on this condition .

Any idea will be much more appreciated . whatever c++ or c# is OK .

Thanks
Posted
Comments
Niklas L 17-Aug-10 2:37am    
So, you are not allowed to recode the DestinationCMD, or have no access to do so?
wenqing632 17-Aug-10 3:56am    
yep ! some guys said i can get DestinationCMD's handle , then send the keys . it's not good i think . may it's tough to wrap a loose controled process ! i don't know whether the Creatpipe API can contact with existed process .

1 solution

Pretty much any Interprocess Communication[^] method can be used.
 
Share this answer
 
Comments
wenqing632 17-Aug-10 1:10am    
Hi Niklas,
Thanks for your provide IPC solutions, and after i investigate them , i found both the server&Client actually will be under our designed while using IPC mechanisms , Go back to my condition , i really wanna find a solution to wrap the existed cmd.exe process and then to handle its' input and output stream . Maybe using the IPC way can resolve it , but sorry to say i am not good at this and even i can't find a clear schema for this .
Could you give me a raw working flow to simply tell the steps ? Thanks a lot !
ThatsAlok 17-Aug-10 2:24am    
The whole idea of IPC is quite vast, please do provide specific method to do so!
wenqing632 17-Aug-10 3:49am    
Ok, i saw API function [CreatePipe] which has WriteFile&ReadFile , does this func is feasible to wrap the existed cmd process which manually startup , and then we can send command & get output ? Thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900