I can create a process just fine and send a command to it on start up .
My question:
- is let's say a new process is created
- e.g. a new
cmd
window - and it has a
pid
of 007.
How do i send another command - for example DIR
- to do it later on?
I know how to concatenate and send multiple commands during process creation ,but i want to know how to send command after the process is created e.g. after i see my new cmd
console with pid 007 on screen.
I read that I could use the Windows WriteFile function, but i don't know .
STARTUPINFO siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
memset(&siStartupInfo, 0, sizeof(siStartupInfo));
memset(&piProcessInfo, 0, sizeof(piProcessInfo));
siStartupInfo.cb = sizeof(siStartupInfo);
siStartupInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_FORCEOFFFEEDBACK | STARTF_USESTDHANDLES;
siStartupInfo.wShowWindow = SW_HIDE;
if (CreateProcess(MyApplication, "", 0, 0, FALSE, 0, 0, 0, &siStartupInfo, &piProcessInfo) == FALSE)
// How do i send lets say command dir to my process here.
return 0;
}