4

I have a process that doesn't behave when I do a taskkill -f, but the only option taskkill gives me is to kill it with -f.

When I have the exe running in the Command Prompt I can hit Ctrl + C twice and it exits gracefully with a keyboard interrupt message (it's a Python compiled exe).

How can I simulate this behavior from the command line?

Gaff
  • 18,569
  • 15
  • 57
  • 68
V_H
  • 195
  • 1
  • 6
  • I really don't know if you can, but this might guide you: http://msdn.microsoft.com/en-us/library/ff540312.aspx http://msdn.microsoft.com/en-us/library/ff541727.aspx http://msdn.microsoft.com/en-us/library/ff539293.aspx – KCotreau Jun 19 '11 at 01:07

1 Answers1

2

That depends from what command-line tools you have. If you have JP Software's TCC/LE, you just activate the running program's console's window with the ACTIVATE command and then use the KEYSTACK command to simulate that keystroke as input to the window with:

KEYSTACK Ctrl-C

Of course, if your program does not actually have a console when run, you do not have the option of simulating pressing Ctrl+C in its console. ☺

JdeBP
  • 26,613
  • 1
  • 72
  • 103