Previous Topic: General AutoShell CommandsNext 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 a child process. A user-specified OSRedirect object or a default system variable ($$stdout) captures child process output automatically.

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 parentheses.

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:

OSRedirect Class

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