<cfset LOCAL.cmd = expandPath('..\library\gm.exe') />
<cfset LOCAL.args = "convert image1.jpg image2.jpg" />
<cfexecute variable="gm" errorVariable="error"
name="#LOCAL.cmd#"
timeout="10"
arguments="#local.args#" />
<cfdump var="#gm#" />
此代码总是导致gm中的空字符串。不管我如何执行gm,无论有没有参数。其他示例可以像在CFDocs示例中一样正常运行cmd.exe或netstat.exe。我没有得到任何错误或者errorVariable中的警告,它什么也不做。CFExecute未执行命令
我修改了代码,这个版本无法正常工作或:
<cfset LOCAL.cmd = expandPath('..\library\gm.exe') />
<cfset LOCAL.args = "convert ""#variables.uploadDirectory##LOCAL.file.source#"" ""#variables.uploadDirectory#optimal-#LOCAL.file.source#""" />
<cfexecute errorVariable="error"
name="c:\windows\system32\cmd.exe"
timeout="10"
outputFile="#expandPath('.\gm.log')#"
arguments="/C#local.cmd# #LOCAL.args#" />
发布一些代码会很有帮助。 – 2010-05-05 15:28:52
你期待什么回应? – 2010-05-05 16:07:19
此外,当您直接从命令行运行它时,该示例是否在与CF相同的用户帐户下运行? – Leigh 2010-05-05 16:09:48