Take the 2-minute tour ×

am opening command prompt using system command like system("start cmd.exe") and then running some batch file. I want to stop the batch file running in command prompt or close the command prompt window. Could you please help me with this.

share|improve this question
possible duplicate of How to close command prompt Window in Ruby? –  Mischa Aug 3 '11 at 14:15
add comment

1 Answer

If you want the command prompt to terminate you just write the following in your script..:


To stop the batch file I will use win32ole lib and send a CTRL+C combo like this..:

require "win32ole"

key = WIN32OLE.new('Wscript.Shell')

share|improve this answer
add comment

Your Answer


