Using CFEXECUTE to run a batch file

880 views
Skip to first unread message

peter....@ebisprint.com

unread,
Dec 20, 2007, 9:01:21 AM12/20/07
to cfaussie
I have a batch file d:\test.bat which I would like to execute to run
on the server.

My command is as follows

<cfexecute name="d:\test.bat"
timeout="10">
</cfexecute>

This will echo the contents of the file test.bat to the screen rather
than execute the file.

Am I missing something simple

Bruce Trevarthen (B2 Limited)

unread,
Dec 20, 2007, 2:06:38 PM12/20/07
to cfau...@googlegroups.com
I think if you change the suffix of the file to .cmd it will run.

Adam Chapman

unread,
Dec 20, 2007, 3:44:03 PM12/20/07
to cfau...@googlegroups.com
Hi Peter,

I use cfexecute like this:

<cfexecute name="#batPath#" outputfile="#outputFilePath#" arguments=""
timeout="10" />

Regards,
Adam

Kym Kovan

unread,
Dec 20, 2007, 6:54:59 PM12/20/07
to cfau...@googlegroups.com
Hello,

You need to get the OS Command.exe to run the batch file so try this
<cfset batchfilename = work_dir & "LOGTEST.BAT">
<cfset variousParameters = "lots of parameters with spaces between them">
<cfexecute name="D:\winnt\system32\CMD.EXE" arguments="/C
#batchfilename# #variousParameters#"></cfexecute>


All the best to everyone for the festive season and the New Year.

Kym K

Reply all
Reply to author
Forward
0 new messages