CFML Reference
|
|
ColdFusion Tags
|
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:
- If the application name is not found: Application File Not Found
- If the output file cannot be opened: Output File Cannot
- If the effective user of the ColdFusion executing thread does not have permissions to execute the process: a security exception
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>
Comments