title: Closing console application after completion from Python
body: <p>I have an exe file that I have to call with several parameters, and for this purpose I use a bat file. After I execute bat file command prompt does not close, but wait for me to press a key. Now I have to run this exe several times, and for this I want to run a script that will do it for me.  </p>
  
  <pre><code>i = 0
  for path in Paths
      outout = codecs.open('runExe.bat', 'w')
      output.write(PathToExe + " -param1" + " -param2 " + param2Val[0] + " -param3 " + param3Val[0] + " -param4 " + param4Val[0] + " -param5 param5Val")
      output.close()
      subprocess.call(["regsvr32.exe", path, "-u", "-s"])
      subprocess.call(["regsvr32.exe", path, "-s"])
      subprocess.call("runExe.bat")
      i + = 1
  </code></pre>
  
  <p>where param3Val, param4Val, param5Val are lists with values for related command prompt parameters.<br>
  When I call this bat file, everything works perfectly for the first fun of exe, but after it executes, command promt waits for my respond. When I press any key, it closes and then exe file starts with different parameters.<br>
  So I want to eliminate with key-pressing thing. I tried to put "exit" to the end of the bat file, but it did not work. How can I close command prompt window from script, when exe finishes working?<br>
  Thanks in advance!
  <img src="https://i.stack.imgur.com/mH4kq.png" alt="enter image description here">
  Upd1: sarmold's way of doing thing works fine, but I think this it is exe (console application) that is waiting for my response.  Smth in exe file prevents console window from closing, but I do not have access to sources. How can I close it's window after it executes?</p>
  
  <p>Upd2: I have tried to add "shell" call after subprocess.call, but this does not seem to work either, still have to respond to the console manually :(  </p>
  
  <pre><code>shell = win32com.client.Dispatch("WScript.Shell")
  shell.AppActivate("Command Prompt")
  shell.SendKeys("cls(ENTER)")
  </code></pre>