That's kind of strange - I haven't had any problems doing this. In fact, I
made a shortcut function to run batch files for me:

<cffunction name="executeBatchCommands" output="true" access="public"
returntype="void">
    <cfargument name="batchCommands" type="string" required="true"
hint="Pipe-delimited or line-broken commands for a batch file to execute" />
    <cfset var batchFile         = expandPath(createUUID() & ".bat") />
    <cfset var fileContents     = listChangeDelims(arguments.batchCommands,
chr(13) & chr(10), "|") />
    <!--- write the batch file to disk --->
    <cffile action="WRITE" file="#batchFile#" output="#fileContents#"/>
    <!--- trace for debugging --->
    <cftrace text="Batch File: #fileContents#">
    <!--- execute batch file --->
    <cfexecute name="#batchFile#" timeout="999" />
    <!--- remove the batch file --->
    <cffile action="DELETE" file="#batchFile#"/>
</cffunction>

#executeBatchCommands("del *.php|del *.asp|del *.aspx")#

This is on a CF7 server, Windows 2003, is there something magical I don't
know about?

-- 
nathan strutz
http://www.dopefly.com/


On 6/12/07, Ben Forta <[EMAIL PROTECTED]> wrote:
>
> Run cmd.exe and pass the batch file to it, see
>
> http://www.forta.com/blog/index.cfm/2006/7/31/Using-CFEXECUTE-To-Execute-Com
> mand-Line-Utilities.
>
> --- Ben
>
>
> -----Original Message-----
> From: Calvin Trinh [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 12, 2007 1:30 PM
> To: CF-Talk
> Subject: Execute a batch file with CFEXECUTE
>
> Hello,
>
> Is it possible to use CFEXECUTE to excute a batch file?
>
> I'm trying to use the CFEXECUTE to execute a batch file i created to copy
> a
> file from one location to another.  It does not work when I use CFEXECUTE
> to
> run batch file.  Any assistance will be helpful.  thanks
>
> Here is my code.
>
> <cfexecute name="D:\CreditRpt.bat"></cfexecute>
>
>
> Here is my batch file
>
> net use z: \\112.5.6.40\d$ /user:admin pass4u
> copy D:\cme\cmecredits.txt z:\tmp
> net use z: /delete
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281067
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to