I can open a command-line program by using:
ShellExecute(Handle, 'open', 'example.exe', nil, nil, SW_SHOWNORMAL) ;
The program waits user input (for example the key "q"). How can i send keys to the program while it is running?
As advised by Uwe Raabe,
DosCommand1.CommandLine:='example.exe';
DosCommand1.Execute;
...
DosCommand1.SendLine('q',True);