I need to run a command line and get its output into a variable. For example, I need to get the computer hostname and save it into a variable called “host_name”
@cirillo I think you can use the Command Line action same as you use the cmd in Windows. i.e. cmd /c hostname.
Not sure about the variable part
This can be done using the “Run Command Line” action in ScenarioBuilder. You will have to write the command in the “Program/Command Name” property. To use the operating system command lines, you can start them with “cmd /c”. Then you can specify an automai regular expression format to get the output into a scenario variable.
The documentation for automai regular expression says:
“Reg Expression – use a regular expression to read the execution results.
For example, for ping www.automai.com, expression #output# will place what the command returns in the variable output, and expression sent = #sent# will place what is between =space and comma in the SENT variable.”
The scenario below will put the computer hostname into a variable named “output”: