Let's say I want to send a text message automaticly to a program that's running (which one should be defined by selecting a directory)

Or just if I have "cmd" open. I should be able to start a command line, like "rename *.jpg *.bmp" or something alike, and if the "cmd" isn't open, it should tell the user that the program isn't loaded. Is there any API command for this or anyone with a good code to check over?