Hi!
Is it possible to send a Ctrl C to a running program if You know its processID?
I have "cmd" running a command line program. And to stop it it requires that Ctrl + C is pressed or the key x.
It is not running in a visible cmd window.
Thanks for any help!
sending Ctrl+C to a running program?
Moderators: Dorian (MJT support), JRL
-
- Pro Scripter
- Posts: 149
- Joined: Tue Mar 23, 2004 9:11 pm
I think you'll have to setfocus to the window using its name or handle. The window will then become visible. Once the window is visible you should be able to send the keys to it.
Similar to this.
Similar to this.
Code: Select all
Let>RP_WINDOWMODE=0
Let>RP_WAIT=0
Run>cmd /k
Wait>2
SetFocus>CMD*
Send>Exit%crlf%
-
- Pro Scripter
- Posts: 149
- Joined: Tue Mar 23, 2004 9:11 pm
Thanks to both of You for Your input!
1. The first approach seamed promising and worked as long as it is a user that starts the compiled script. In my case it is wepbage with a a php script , like:
exec('compiledscript.exe')
and then i can not get the window to show. It is not even sure that there is a user loged in to the windows machine that runs the Apache webserver..
2. it is not possible to kill it. cos it have to close controlled to render valid result.
I found this program that sends CTRL + c to a program. But it turns out , in my case, that I have to press q to end my program correctly.
http://www.latenighthacking.com/project ... endSignal/
Thanks!
1. The first approach seamed promising and worked as long as it is a user that starts the compiled script. In my case it is wepbage with a a php script , like:
exec('compiledscript.exe')
and then i can not get the window to show. It is not even sure that there is a user loged in to the windows machine that runs the Apache webserver..
2. it is not possible to kill it. cos it have to close controlled to render valid result.
I found this program that sends CTRL + c to a program. But it turns out , in my case, that I have to press q to end my program correctly.
http://www.latenighthacking.com/project ... endSignal/
Thanks!
-
- Pro Scripter
- Posts: 149
- Joined: Tue Mar 23, 2004 9:11 pm