mxdeveloper
Macromedia MX related news and discussion
ColdFusion CFSAVECONTENT & CFEXECUTE October 21, 2003

Figured out a quick and elegant way of capturing the results of a CFEXECUTE call. Simply wrap the CFEXECUTE with CFSAVECONTENT, like so:


<cfsavecontent variable="myVar">
   <cfexecute ...>
</cfsavecontent>

Normally, you'd have to save the results to a text file using CFEXECUTE, and then use CFFILE to read the results. A lot of overhead there. Without saving the text file, CFEXECUTE dumps the output to the screen, but there's no way of using that data unless it's in a variable, which is what CFSAVECONTENT does for you.

Posted by Michael Buffington at 10:46 AM in ColdFusion | Permalink
TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8345582c669e200d83457bd1769e2

Listed below are links to weblogs that reference CFSAVECONTENT & CFEXECUTE:

Rob Brooks-Bilson:

In MX 6.1, there's a new VARIABLE attribute in CFEXECUTE that allows you to save the output of the call directly to a variable.

» by Rob Brooks-Bilson at Oct 21, 2003 12:25:39 PM
Steven Erat:

There's a "variable" attribute of cfexecute to hold program output. See: http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p25.htm#wp1098198

» by Steven Erat at Dec 17, 2003 9:08:33 PM
Madeleine McJones:

How about passing stdin not command line information to an executable?

» by Madeleine McJones at Jan 31, 2004 1:54:11 PM
This work is licensed under a Creative Commons License.