4 Replies Latest reply on Dec 9, 2011 8:21 AM by Reed Powell

    How can I get cfexecute to run a bat file? (It is not working for me)


      My server is running the following:

      • Windows Server 2003 R2 Enterprise Edition Service Pack 2
      • Coldfusion 9,0,0,251028 Standard Edition
      • Java Version 1.6.0_14
      • Coldfusion Application Service Log On set to Local System Account



      I'm running some command line software to generate audio for a custom captcha form. I can't get this bat file to run with cfexecute. I can run the bat fine if I run it manually and it generates the .wav file but it will NOT run with cfexecute. I had tried running the exe with cfexecute while passing the arguments and all that outputed to the page was "[empty string]". I have read pretty much every forum post I can find searching through google and can't find the solution to my problem. Please someone help me out I'm wracking my brain over this.



      Variables passed:

      • FileName=NFACZMU2-050031.wav
      • cap=NFACZMU2


      <cfparam name="FileName" default="">

      <cfparam name="Cap" default="">


      <cfset newString = "">


      <cfloop index="intChar" from="1" to="#Len( Cap )#" step="1">

                <cfset strChar = Mid( Cap, intChar, 1 ) />

                <cfset newString = newString & "#strChar#.....">




      <cfsavecontent variable="cmd_content">C:\TSC.exe /s "#newString#" C:\Inetpub\wwwroot\captcha\#FileName# Mary (for Telephone)</cfsavecontent>



      <cfset cmd_filename = "#ListFirst(FileName, ".")#.cmd">


      <cffile action="write" file="C:\Inetpub\wwwroot\captcha\#cmd_filename#" output="#cmd_content#">


      <cfexecute name="C:\Inetpub\wwwroot\captcha\#cmd_filename#" outputFile="C:\testoutput.txt" timeout = "90"></cfexecute>




      This is the content of testoutput.txt when the script is ran:


        C:\ColdFusion9\runtime\bin>C:\TSC.exe /s "N.....F.....A.....C.....Z.....M.....U.....2....." C:\Inetpub\wwwroot\captcha\NFACZMU2-050031.wav Mary (for Telephone)


      What am I doing wrong?