cfexecute
Description
Executes a ColdFusion developer-specified process on a server computer.
Categories
Related
History
ColdFusion
MX 6.1:
Added the variable attribute.
Changed filepath behavior for the outputFile attribute:
if you do not specify an absolute filepath in the outputFile attribute,
the path is relative to the ColdFusion temporary directory.
Syntax
<cfexecute
name = "application name"
arguments = "command line arguments"
outputFile = "output filename"
timeout = "timeout interval"
variable = "variable name">
...
</cfexecute>
Note: You can specify
this tag’s attributes in an attributeCollection attribute
whose value is a structure. Specify the structure name in the attributeCollection attribute
and use the tag’s attribute names as structure keys.
Attributes
| Attribute | Description | Required | Default |
|---|---|---|---|
| arguments | 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. | Optional | |
| name | Absolute path of the application to execute. On Windows, specify an extension, for example, C:\myapp.exe. | Required | |
| outputFile | File to which to direct program output. If no outputfile or variable attribute is specified, output is displayed on the page from which it was called. If not an absolute path (starting with a drive letter and a colon, or a forward or backward slash), it is relative to the ColdFusion temporary directory, which is returned by the GetTempDirectory function. | Optional | |
| timeout | Length of time, in seconds, that ColdFusion waits for output from the spawned program. 0: equivalent to nonblocking 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 | Optional | 0 |
| variable | Variable in which to put program output. If no outputfile or variableattribute is specified, output is displayed on page from which it was called. | Optional |
Usage
Do not put other ColdFusion tags or functions between the start and end tags of cfexecute. You cannot nest cfexecute tags.
Example
<h3>cfexecute</h3>
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>