如果使用 Windows,CFX_EXEC 是一个选项,它提供了比 ColdFusion 的内置 CFExecute 更多的功能:
http://adiabata.com/cfx_exec.cfm
它是用 C++ 编写的,应该适用于您可以在 Windows 上成功安装的所有 ColdFusion 版本。它将使您能够在特定帐户下运行外部进程,甚至可以执行即时批处理文件创建。
<!--- Credential Check --->
<cf_exec fnc="USER" user="#user#" pwd="#pwd#" domain="#domain#">
<cfif status neq "OK">
<cfoutput>Error: #MSG#<br>
Error number: #ERRN#</cfoutput>
<cfelse>
Credentials OK
</cfif>
<!--- On-the-fly BAT file --->
<cf_exec cmd="cmd.exe" user="#user#" pwd="#pwd#" domain="#domain#">
@echo off
netstat -e
cd c:\
dir "<cfoutput>#dir#</cfoutput>"
ipconfig /all
exit
</cf_exec>