Backtick with variables?


#1

I want to run an external command and capture the output.

hosts =net view

will store the results from running net view (XP command to list
machines on network) in a string called hosts.

How do I execute a command stored in a string and capture its output
though?


#2

Hi,

From: removed_email_address@domain.invalid

I want to run an external command and capture the output.

hosts =net view

will store the results from running net view (XP command to list
machines on network) in a string called hosts.

How do I execute a command stored in a string and capture its output
though?

cmd = “net view”
hosts = #{cmd}

There’s also popen() if you would prefer to read the output from a
pipe.

Regards,

Bill