tags:

views:

135

answers:

2

Hi , I try to wrap the cmd.exe console and would like to be able to use the underlying command interpreter to be run by my app. This will allow me for ex to execute dynamically created script and other thing ( the question is not about how to do execute dynamically created script , but about getting an interpreter loop around the different command of the shell ). My last option would be to rewrite the command myself(copy,dir,...) but would rather reuse the the cmd.exe interpreter.

Thx

+1  A: 

Well this will probably be difficult. But you could invoke cmd.exe with the /k command option and redirect stdin/stdout to your own buffers. See Creating a Child Process with Redirected Input and Output for information on the stdin/out redirection.

Mike Weller
Actually i have already done this and it works, but this issue is that you can't get informed that a command completed , you have to wait on the output handle to see if you don't get anything more and that you get the prompt as last output. This a bit crappy, that is why i want to be able to talk directly to the underlying interperter to be able to control every single command command
+1  A: 

take a look at cmd.exe replacemnt opensource project - Console you might be able to modify this code

Alon