# Running Gatling CLI for external folder simulations

**URL:** <https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531>\
**Category:** Gatling (Open-Source)\
**Created:** [August 5, 2013, 5:16am UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531 "2013-08-05T05:16:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vaikuntham\_Jagannath](https://avatars.discourse-cdn.com/v4/letter/v/a4c791/32.png) [@Vaikuntham\_Jagannath](https://community.gatling.io/u/Vaikuntham_Jagannath)\
**Post date:** [August 5, 2013, 5:16am UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531/1 "2013-08-05T05:16:10Z")

</div>

Hi,

I have been trying to use Gatling for running tests from an folder external to where Gatling is .

Example :

**GATLING FOLDER** : C:\Tools\gatling

**TESTS\_FODER** : C:…\Desktop\GUD

this folder contains folders **data , request-bodies, simulations.** The **reports folder** is auto generated when ran from CLI.

I am able to run the following command

[from inside bin\folder]

**gatling.bat -df C:…\Desktop\GUD\data -rf C:…\Desktop\GUD\reports -bf C:…\Desktop\GUD\request-bodies -sf C:…\Desktop\GUD\simulations**

But when trying to run **-s advanced.AdvancedLoopDataSimulation** in addition to the above command :

It Throws An Error :  
**Error: missing value after -s**

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [August 5, 2013, 6:38am UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531/2 "2013-08-05T06:38:04Z")

</div>

Which version do you use?

---

<div class="post-metadata">

**Author:** ![Vaikuntham\_Jagannath](https://avatars.discourse-cdn.com/v4/letter/v/a4c791/32.png) [@Vaikuntham\_Jagannath](https://community.gatling.io/u/Vaikuntham_Jagannath)\
**Post date:** [August 5, 2013, 6:42am UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531/3 "2013-08-05T06:42:25Z")

</div>

The version of Gatling is 1.5.2

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [August 5, 2013, 8:37pm UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531/4 "2013-08-05T20:37:59Z")

</div>

I can’t reproduce on OS X and won’t be able to get my hands on a Windows machine, sorry.  
Can anybody else help?

---

<div class="post-metadata">

**Author:** ![Marko\_Marjanovic](https://avatars.discourse-cdn.com/v4/letter/m/f14d63/32.png) [@Marko\_Marjanovic](https://community.gatling.io/u/Marko_Marjanovic)\
**Post date:** [August 12, 2013, 2:07pm UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531/5 "2013-08-12T14:07:09Z")

</div>

Hi,  
I want to do a similar thing as Vaikuntham - start test cases from Ant script. But when I execute “gatling.bat -df … - rf … -bf … -sf …” Gatling doesn’t recognize these parameters. I checked Gatling.bat and it seems that it doesn’t accept any parameters.  
Is there a way to run Gatling scripts from outside the Gatling home file tree structure?

Best regards,  
Marko

---

<div class="post-metadata">

**Author:** ![Vaikuntham\_Jagannath](https://avatars.discourse-cdn.com/v4/letter/v/a4c791/32.png) [@Vaikuntham\_Jagannath](https://community.gatling.io/u/Vaikuntham_Jagannath)\
**Post date:** [August 13, 2013, 12:41pm UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531/6 "2013-08-13T12:41:34Z")

</div>

Hi Marko,

I think you can do that;But if you run it that way it still asks you to specify which simulation to be run. If you try specifyiing the **gatling.bat -df … - rf … -bf … -sf … with an -s option it breaks.** It tries to search in the default gatling location.

---

<div class="post-metadata">

**Author:** ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)\
**Post date:** [August 13, 2013, 7:07pm UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531/7 "2013-08-13T19:07:38Z")

</div>

Hi,

The problem is that, currently, gatling.bat only support up to 9 command line parameters. 9 parameters covers : **-df … -rf … -bf … -sf … -s,** but not the simulation name after **-s.**  
It’s kind of a limitation of batch scripts, but I think we can overcome it.  
No wonder Stéphane couldn’t reproduce on Mac OS X, as it only happens with gatling.bat, therefore on Windows.  
I’ll see if we can do something about it.  
As a workaround, if you don’t often switch folders for **df _/_ rf** / **bf** / **sf** , you can always modify the default folders in gatling.conf.  
The corresponding keys in gatling.conf are :

- df : gatling.core.directory.data
- rf : gatling.core.directory.results
- bf : gatling.core.directory.requestBodies
- sf : gatling.core.directory.simulations
- s : gatling.core.simulationClass  
Setting only one of these folders in gatling.conf would make enough room on the command line to allow **-s** to work 😉

Cheers,

Pierre

---

<div class="post-metadata">

**Author:** ![Marko\_Marjanovic](https://avatars.discourse-cdn.com/v4/letter/m/f14d63/32.png) [@Marko\_Marjanovic](https://community.gatling.io/u/Marko_Marjanovic)\
**Post date:** [August 14, 2013, 6:33am UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531/8 "2013-08-14T06:33:23Z")

</div>

The problem I had was due to the relative paths I used. I noticed that soon after posting here (doh!). But then I ran into the problem with “-s”.  
Now it’s clear what’s going on. Thanks!

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [August 27, 2013, 9:50am UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531/9 "2013-08-27T09:50:02Z")

</div>

@Pierre Any update on this Windows/-s stuff?

---

<div class="post-metadata">

**Author:** ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)\
**Post date:** [August 27, 2013, 1:58pm UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531/10 "2013-08-27T13:58:29Z")

</div>

The 9 parameters can be overcome using SHIFT, which shifts params ids by one each time it’s called : %1 becomes %0, %2 becomes %1, etc…

However, using SHIFT is interesting only if parameters can be immediately handled.  
For example, this could work for a script which renames folders :

- The first folder name is read from the first argument, %1
- The folder gets renamed
- Args are SHIFTed
- The second folder name is read from the second argument, which is now %1 after the shift
- etc…  
However, it looks like we can use %\* to pass arguments to Gatling, as we don’t need to process arguments in the .bat script.

---

<div class="post-metadata">

**Author:** ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)\
**Post date:** [August 27, 2013, 6:46pm UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531/11 "2013-08-27T18:46:06Z")

</div>

Good news : %\* did the trick, and it’s fixed on master on 1.5.X.  
To get this fix before the next release, you can replace your current gatling.bat by :

- this one for Gatling 1.5 : [https://github.com/excilys/gatling/raw/3d0d04a68e4181e1fd8bb4629f0e53bc94418148/gatling-bundle/src/main/assembly/assembly-structure/bin/gatling.bat](https://github.com/excilys/gatling/raw/3d0d04a68e4181e1fd8bb4629f0e53bc94418148/gatling-bundle/src/main/assembly/assembly-structure/bin/gatling.bat)
- Or this one for Gatling 2.0-M3: [https://github.com/excilys/gatling/raw/4d2f47cf5d2077364ab52b2d477d4ca9d9b99550/gatling-bundle/src/main/assembly/assembly-structure/bin/gatling.bat](https://github.com/excilys/gatling/raw/4d2f47cf5d2077364ab52b2d477d4ca9d9b99550/gatling-bundle/src/main/assembly/assembly-structure/bin/gatling.bat)

Or you can edit gatling.bat yourself and replace “%1 %2 %3 %4 %5 %6 %7 %8 %9” by “%\*” :

- on line 62 for Gatling 1.5
- on line 46 for Gatling 2.0-M3

Cheers,

Pierre

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [August 27, 2013, 6:48pm UTC](https://community.gatling.io/t/running-gatling-cli-for-external-folder-simulations/531/12 "2013-08-27T18:48:23Z")

</div>

Nice work!
