View comments | RSS feed

cfexecute

Description

Executes a ColdFusion developer-specified process on a server computer.

Category

Extensibility tags, Flow-control tags

Syntax

<cfexecute 
  name = " ApplicationName "
  arguments = "CommandLine Arguments"
  outputFile = "Output file name"
  timeout = "Timeout interval">
  ...
</cfexecute>

See also

cfcollection, cfindex, cfobject, cfreport, cfsearch, cfwddx

Attributes

Attribute Req/Opt Default Description
name
Required

Absolute path of the application to execute.
On Windows, you must specify an extension; for example, C:\myapp.exe.
arguments
Optional

Command-line variables passed to application. If specified as string, it is processed as follows:
  • Windows: passed to process control subsystem for parsing.
  • UNIX: tokenized into an array of arguments. The default token separator is a space; you can delimit arguments that have embedded spaces with double quotation marks.
If passed as array, it is processed as follows:
  • Windows: elements are concatenated into a string of tokens, separated by spaces. Passed to process control subsystem for parsing.
  • UNIX: elements are copied into an array of exec() arguments.
outputFile
Optional

File to which to direct program output. If not specified, output is displayed on page from which it was called.
timeout
Optional
0
Length of time, in seconds, that ColdFusion waits for output from the spawned program.
  • 0: equivalent to non-blocking mode.
  • A very high value: equivalent to blocking mode
If the value is 0:
  • ColdFusion starts a process and returns immediately. ColdFusion may return control to the calling page before any program output displays. To ensure that program output displays, set the value to 2 or higher.
  • If the outputFile attribute is not specified, any program output is discarded

Usage

Do not put other ColdFusion tags or functions between the start and end tags of cfexecute. You cannot nest cfexecute tags.

Exception

Throws the following exceptions:

The time out values must be between zero and the longest time out value supported by the operating system.

Example

<h3>cfexecute</h3>
<p>This example executes the Windows NT version of the netstat network 
monitoring program, and places its output in a file.

<cfexecute name = "C:\WinNT\System32\netstat.exe"
  arguments = "-e" 
  outputFile = "C:\Temp\output.txt"
  timeout = "1">
</cfexecute>

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6

Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.

Comments


Sceiron said on Dec 10, 2004 at 6:50 AM :
Why is there a closing tag for this one?
stijncatv5 said on Mar 8, 2005 at 10:47 PM :
hmmm not sure why?
No screen name said on May 11, 2005 at 11:32 AM :
I would prefer to be able to store the output in a variable, instead of writting it to a file, so that I may send the result in an email.

does the text file output create a new file or overwrite, or does it append? If I want to keep a log do I have to create a unique text file for every instance?
autrv said on Jun 1, 2005 at 9:14 PM :
what version of CF first supported this tag?
jrunrandy said on Jun 28, 2005 at 12:20 PM :
Version 4.5.

FYI, you can download a CFML History technote/fileset from http://www.macromedia.com/go/tn_18791

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/Tags-pt126.htm