View Full Version : Capture shell command output

01-07-2008, 09:59 AM
Hi, does anyone know if its possible to execute an external shell command (I beleive this is possible) and capture the output of that command into a text buffer for future action?

I know this kind of thing is possible in other scripting languages (Perl, Python etc). But I can't see how to do the same thing in AMS 7.0

Any pointers appreciated.



01-09-2008, 07:07 PM
If you are calling a console application, you should be able to redirect the output to a text file, and read it back in AMS. For example:

res = File.Run("C:\\WINDOWS\\SYSTEM32\\CMD.EXE", "/C chkdsk C: >output.txt", "D:\\TEMP", SW_SHOWNORMAL, true);

This will fire up the checkdisk utility, and output all text normally displayed to a text file "output.txt", located in the D:\TEMP folder. All you have to do is read this file now, for whatever purpose... and then delete the file when you don't need it any more.