# Pass parameters to NR instance

**URL:** https://discourse.nodered.org/t/pass-parameters-to-nr-instance/54644
**Category:** General
**Created:** [2 December 2021 20:06 UTC](https://discourse.nodered.org/t/pass-parameters-to-nr-instance/54644 "2021-12-02T20:06:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Onixarts](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/onixarts/32/6052_2.png) [@Onixarts](https://discourse.nodered.org/u/Onixarts)
#### Post date: [2 December 2021 20:06 UTC](https://discourse.nodered.org/t/pass-parameters-to-nr-instance/54644/1 "2021-12-02T20:06:08Z")

</div>

Hi. My NR system is growing, so I decide to split functionality into many separate NR instances. I want extract some settings from existing flows, like mqtt server adress, device/service (NR instance) name and so on.

The mqtt server parameters are easy to handle, as set the env variable in settings.js - which is common to each NR instance. But I can't figure it out, how to pass instance name to NR instance, which I could use then in MQTT will topic for example.

Is there any option to pass some parameters (env variables?) to NR instance? I'm not using docker.

---

<div class="post-metadata">

### Author: ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)
#### Post date: [2 December 2021 20:19 UTC](https://discourse.nodered.org/t/pass-parameters-to-nr-instance/54644/2 "2021-12-02T20:19:02Z")

</div>

Set them as real (not in settings.js) environment varariable that are in scope before you start each instance.

How you actually set them depends on what OS you are running on

---

<div class="post-metadata">

### Author: ![Onixarts](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/onixarts/32/6052_2.png) [@Onixarts](https://discourse.nodered.org/u/Onixarts)
#### Post date: [2 December 2021 21:25 UTC](https://discourse.nodered.org/t/pass-parameters-to-nr-instance/54644/3 "2021-12-02T21:25:35Z")

</div>

Oh thank You. Just searched the Internet for scoped environment variables and found this:

for Linux:

```auto
env VAR1="value" command_to_run command_options

```

and for Windows (my current case):

```auto
cmd /c "(set VAR1=value && command_to_run command_options)"

```

Note that, my goal was to call NR in one line, without batch file, and without the current environment being affected by seting new env variables. This variables should be visible only in that context, so I have to call new `cmd /c` to nest the command shell and then chain `set` and `command_to_run` with `&&`. Important thing are the parentheses `( )` which groups or nest multiple commands. Without these the node-red can't see previously set variables.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [31 January 2022 21:26 UTC](https://discourse.nodered.org/t/pass-parameters-to-nr-instance/54644/4 "2022-01-31T21:26:13Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
