Executing Programs
As
of ColdFusion 4.5, you can execute command-line programs residing on
the same machine as the ColdFusion Application Server, using the
CFEXECUTE
tag. This tag allows you to call
external programs such as batch utilities from within your ColdFusion
application. The following syntax calls an external program using
CFEXECUTE
:
<CFEXECUTE NAME="path_to_program_to_execute
" ARGUMENTS="argument_string
" OUTPUTFILE="path_to_output_file
" TIMEOUT="timeout_in_seconds
"> </CFEXECUTE>
The NAME
attribute
is required and specifies the full path, including filename to the
file you want to execute. Depending on the program you are attempting
to execute, you may be able to specify just the program name without
the full path. ARGUMENTS
allows you to specify any
optional arguments you want to pass to the external program.
ARGUMENTS
can be either strings or arrays and
adhere to the following conventions:
-
Strings
On Windows platforms, the entire string is passed to the Windows process control subsystem for processing.
On Unix and Linux systems, the string is tokenized into an array of strings, delimited by spaces. If spaces occur in the array elements, they are escaped by double quotes.
-
Arrays
On Windows platforms, the elements of the array are concatenated into a space-delimited string of tokens, which is then passed to the Windows process control subsystem for processing.
On Unix and Linux systems, the elements of the array are copied into an array of
exec( )
arguments.
The next ...
Get Programming ColdFusion now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.