How To Capture Command Output With ReadString() Using SecureCRT® for Windows®
Note: This tip is for use with SecureCRT for Windows.
Have you ever wanted to run a command from a script and log just the output
from those commands? You can do this using ReadString(), a method
of the Screen object which gives access to data as it comes from
the remote system. The script example, LogOutputOfSpecificCommand-UseReadString,
executes a set of shell commands, and logs the results to a file.
ReadString() operates in a manner similar to the WaitForString()
method, returning all data received until a specified string is detected.
By default, the data captured includes escape sequences, but there is
a way to exclude these sequences by setting the IgnoreEscape
property to True as shown in the example script code.
The example script assumes that SecureCRT is already connected to the
remote device; otherwise the script exits with an error message. The
script comments suggest how to add the connection sequence if needed.
Here you can control cookies using the checkboxes below. Some cookies are essential for the use of our website and cannot be disabled. Others provide a convenience to the user and, if disabled, may reduce the ease of use of our site. Finally, some cookies provide anonymous analytic tracking data that help us provide the user with a richer browsing experience. You can elect to disable these cookies as well.