Previous Topic: General AutoShell Commands

Next Topic: ! Command--Invoke Command or Child Process (Cmdlet)


!! Command--Invoke Command or Child Process and Auto-capture Output (Cmdlet)

Run an operating system command or start an application as child process. A user-specified OSRedirect object or a default system variable ($$stdout) automatically captures child process output.

The command has the following syntax:

!! cmd [-output osRedirect]
cmd

Command to execute or application to run. Multiple commands can be concatenated using a && sequence. Unquoted argument tokens are automatically stringified. Prevent automatic quoting for expressions by placing expression code in parenthesis.

osRedirect

(Optional) Existing OSRedirect object to receive the output of the child process and capture it in the specified variable.

Default: $$stdout

Examples

Get DOS memory information about Windows OS with output redirected to a variable, out, that is not initialized before the call:

!! mem -output out
// Output line by line
aLines = out.output().split(String.fromCharCode(10));
arrdump aLines

Perform a DNS lookup and automatically capture the output to $$stdout:

!! nslookup ca.com
? $$stdout.output()

See also:

! Command--Invoke Command or Child Process (Cmdlet)

OSRedirect Class