How can i run a command on the command prompt with a batch file and keep running it for 'n' seconds?
<p>How can i run a command on the command prompt with a batch file and keep running it for 'n' seconds ? and then close it automatically ? (All in Background i.e without opening the console)</p>

<p>Create any python(.py) file and run it like</p>

<p><code>c:\python27\python.exe &lt;path_of_the_file&gt;/filename.py</code></p>

<p>To keep running it over say, 1000 times:</p>

<p><code>for /l %x in (1, 1, 1000) do c:\python27\python.exe &lt;path_of_the_file&gt;/filename.py</code></p>

<p>Note: Assuming your python is installed at c:\python27\</p>

python python-2.7 python-3.x command-line subprocess