I am executing batch commands via a C program with the CreateProcess function. I check to see if the process has terminated with the GetExitCodeProcess function, by checking to see if the process exit code equals anything except STILL_ACTIVE. This works fine with commands like "cmd /c echo Hello World", but for commands like "cmd /c dir c:\windows" or "cmd /c dir c:\windows & exit", cmd.exe will never terminate. Either command when launched thru the command prompt will terminate as expected. Does anyone know why it never terminates when launched via CreateProcess? Thanks a lot.
type
a textfile. A small textfile will work, while a large textfile will cause your program to hang. – wimh