title: Call a DOS executable file from Python
body: <p>Sorry if this question has been asked many times. I have a DOS .exe file. It works well by double clicking it in Windows, which generates some output files in the working folder. However, I need to call it from Python.
  I have tried the following commands (subprocess.Popen and os.system), but it only opens a DOS window without saving output files. So can someone give me a hint?</p>
  
  <p>Thanks!</p>
  
  <p><strong>CODE</strong></p>
  
  <pre><code>a=subprocess.Popen(r"I:/dosefile.exe")
  a1=os.system(r"I:/dosefile.exe")
  </code></pre>
  
  <p><strong>UPDATE</strong>
   It worked by putting the .py script file to the fold containing dosefile.exe. Is there a way to make it work without migrating .py file?</p>
  
  <p>Figure it out. I need to change the working folder by using os.chdir() if .py file is somewhere else</p>