# How to execute the same script or test N number of times?

**URL:** <https://forum.robotframework.org/t/how-to-execute-the-same-script-or-test-n-number-of-times/3044>\
**Category:** Robot Framework\
**Created:** [5 January 2022 17:46 UTC](https://forum.robotframework.org/t/how-to-execute-the-same-script-or-test-n-number-of-times/3044 "2022-01-05T17:46:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![naveen09](https://avatars.discourse-cdn.com/v4/letter/n/c57346/32.png) [@naveen09](https://forum.robotframework.org/u/naveen09)\
**Post date:** [5 January 2022 17:46 UTC](https://forum.robotframework.org/t/how-to-execute-the-same-script-or-test-n-number-of-times/3044/1 "2022-01-05T17:46:00Z")

</div>

I have a situation where i need to execute a script to enter dummy data into the database. So i probably need to execute script 100k times. I know that there is following way to do it from console:–\> robot --suite tests.testSuite . . . (As many dots we add up, script will be executed those number of times) but in my case or in general probably it’s not an efficient way. Is there any better way to do it ?

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [5 January 2022 17:55 UTC](https://forum.robotframework.org/t/how-to-execute-the-same-script-or-test-n-number-of-times/3044/2 "2022-01-05T17:55:29Z")

</div>

Usually, create a script at Operating System level.  
Using a `bash` script with `for` or a Windows .cmd with `FOR`.

---

<div class="post-metadata">

**Author:** ![naveen09](https://avatars.discourse-cdn.com/v4/letter/n/c57346/32.png) [@naveen09](https://forum.robotframework.org/u/naveen09)\
**Post date:** [5 January 2022 19:01 UTC](https://forum.robotframework.org/t/how-to-execute-the-same-script-or-test-n-number-of-times/3044/3 "2022-01-05T19:01:37Z")

</div>

@HelioGuilherme66 Thanks for your quick response. Would it be able to pass multiple robot files using windows script file ? Any example would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [5 January 2022 23:31 UTC](https://forum.robotframework.org/t/how-to-execute-the-same-script-or-test-n-number-of-times/3044/4 "2022-01-05T23:31:13Z")

</div>

Here is an example for Windows (file: `loop.cmd`):

```python
SET REPETITIONS=2
SET ROBOT_OPTIONS="--dryrun"

FOR %%i IN (%*) DO FOR /L %%N IN (1, 1, %REPETITIONS%) DO robot %ROBOT_OPTIONS% %%i

```
