title: Passing a Python Variable to Batch File
body: <p>I have a basic batch file that takes user input:</p>
  <pre><code>@echo off
  set /p Thing= Type Something: 
  echo %Thing%
  pause
  </code></pre>
  <p>However, I'd like to use a variable written in Python to pass into the batch file. Let's say just a string <code>'arg1'</code> This is just a basic example, but I still cannot figure it out. The below code will run the batch process, but <code>'arg1</code>' has no impact</p>
  <pre><code>import subprocess
  
  filepath = r'C:\Users\MattR\Desktop\testing.bat'
  
  subprocess.call([filepath, 'arg1'])
  </code></pre>
  <p>I have also tried <code>p = subprocess.Popen([filepath, 'arg1'])</code> but the batch file does not run in Python.</p>
  <p>I have searched the web and SO, but none of the answers seem to work for me. Here are some links I've also tried: <a href="https://stackoverflow.com/questions/24156912/passing-arguments-into-batch-file-via-python">Example 1</a>, <a href="https://stackoverflow.com/questions/2916758/running-a-batch-file-with-parameters-in-python-or-f">Example 2</a>. I've also tried others but they seem fairly specific to the user's needs.</p>
  <p>How do I start passing Python variables into my batch files?</p>