title: How to run convert this batch script so it can run on command line and be called by python?
body: <pre><code>SETLOCAL ENABLEDELAYEDEXPANSION
  for %%i in (*.exr) do (
      set z=%%i 
      magick %%i !z:exr=pfm!
  )
  </code></pre>
  <p>I have this batch script that i need to be able to run in python without having and calling the external batch file. Im trying to figure out how i can run this same script just on command line so i can us subprocess to do something like:</p>
  <pre><code>cmd = '''
    SETLOCAL ENABLEDELAYEDEXPANSION
    for %i in (*.exr) do (
        set z=%i
        magick %i !z:exr=pfm!
    )
    ''' 
  
  subprocess.check_output(cmd, shell=True, cwd = convdir)
  </code></pre>
  <p>but cannot get it to work. What is the best method to go about this?</p>