title: Run an executable and giving text file as input using Python on Windows
body: <p>I could make code but freezes after calling the executable. I have searched on StackOverflow and everywhere else for the answer but with no success.<br />
  The question is answered for Linux and the same code I have described below as a sample but it does not work <strong>for windows</strong>. Any input will be of great help.</p>
  <pre><code>import subprocess
  for filename in 'inp1.txt', 'inp2.txt':   #input text files
  
      with open(filename) as infile, open('result_{}'.format(filename), 'w') as outfile:
  
         result = subprocess.run([r'C:\Users\Desktop\Python_files\file.exe'], stdin=infile, stdout=outfile) # executable name is file.exe
  </code></pre>
  <p>When the code is used for Windows, it freezes. Can anyone give any input?</p>