SUPPORT > TIPS
Send us a question or comment

   

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.

If you have any questions about ReadString() or Screen object properties and methods, contact VanDyke Software Support.

Was this information helpful?
Yes No
Thank you!
Send your comments and questions to VanDyke Software Support,
or join the discussion in the VanDyke Software Forums.
Can't find the answer you're looking for?
Ask VanDyke Software Support directly
and we will get back to you as soon as possible.
1.  Read or download one of our secure solutions white papers. 2.  Download a free
30-day evaluation copy of our products.
3.  Let us help define the right Secure Shell solution for your company. 4.  Subscribe to our What's New page for tips, solution ideas, and product news.