How to pass variables when running rcc

I need to pass variables when running a robot. I can find the option is missing from rcc, but I would like to know if I can achieve this feature using some workaround.
Robot framework support passing variable using --variable or -v argument with variable:value as the variable data. The same i tried passing as a parameter within robot.yaml shell value and it worked for me.

So, do we have any plan of including --variable with rcc or do we have any available solution or workaround to achieve this feature?

If you mean environment variables, then use --environment option with either JSON or YAML file. Environment variables are recommended way, since this works with Control Room, Workforces, and Assistants.

Other way is to put those variables in your robot.yaml task definitions. This also works in production settings.

If you want to pass those -v variables, there is kind of work around, but there you have to do more work, see: rcc/recipes.md at master · robocorp/rcc · GitHub

And currently there is no plan to add --variable options. Can you describe what is use-case for your RPA robot that requires this? This might help us understand why this is needed, since in normal Workforce and Assistant runs there is no possibility to do these in production.

1 Like

This works absolutely well rcc run --interactive --task scripting – --variable url:https://www.google.com tasks.robot

You can also do this: MYVARIABLE="123" rcc run

And in the code you can access it with: %{MYVARIABLE}, for example:

Log    This is my "env" variable: %{MYVARIABLE}    console=True

This will not work, as you need provide any configuration after rcc

It does works, you can try it, I don’t know if you refer that it will not work for what you want

I am running this command in windows with rcc.
So to run any exe commands we need to first pass the exe command itself followed by the subsequent instructions.

‘MYVARIABLE’ is not recognized as an internal or external command,
operable program or batch file.

I was waiting for you to answer to reply. I search into this because in Windows it might not work, but in Linux it works. In Windows it will depend on the shell you are using, cmd is different to powershell for example. In those cases you will need to add them the way env variables are added in each shell. In Linux what I wrote works because of the same reason.

You are right, if you want to add variables without limitations from the OS you are using, you can use robotframework way, but you can also do it with the shell properties in which you are running it.

I asked the same thing as you like 2 weeks ago, you can read it in the slack channel with this link

1 Like

Great, i will check out

1 Like