title: Batch script to execute a Python script multiple times
body: <p>I need to run a Python script N times, so I created the following script:</p>
  
  <pre><code>@ECHO OFF
  cd PATH_TO_SCRIPT
  @set port=5682
  set /P INPUT=Number of servers: 
  FOR /L %%I IN (1, 1, %INPUT%) DO (
      @set /a newport=%port%+1
      start cmd /k &gt; start python server.py -i 192.168.1.2 -p %newport%
  )
  pause
  </code></pre>
  
  <p>If I enter <strong>1</strong> as input value, such that there is only one iteration, the script works, but if I choose 2, the script only runs one instance of the server and tells me: "Unable to access file. The file is used from another process". What's wrong?</p>