Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFEXECUTE

Status
Not open for further replies.

Wes98765

Programmer
Jul 31, 2002
135
0
0
US
How do I use cfexecute to run pkzip from dos and zip files in a perticular folder? I have looked all over and can't find anything.

Thanks for any help
 
My suggestion would be to create a bat file that does most of the work and then pass parmaters to the bat file using CFEXECUTE. If you can get the bat file to work alone, but can't get CFEXECUTE to work with it, I can help you from there. - tleish
 
How do you pass arguments to a .bat file? I put some test arguments into the <cfexecute> and it didn't do anythingf? Thanks a lot for your help

Wes
 
Parameters are passed to a bat file through a list format, I believe the delimiter can either be a comma or a space. Then you capture the argument based on it's position in the parameter list with a % in front of it (%1,%2,%3...). The following code below will ping yahoo.com and tek-tips.com and output the results to the screen.


=== START TEST.BAT FILE EXAMPLE ===
REM Ping 2 websites
ping %1
ping %2
=== END TEST.BAT FILE EXAMPLE ===

=== START CF CODE EXAMPLE ===
[COLOR=000080]<pre>[/color]

<cfset strFile = &quot;c:\test.bat&quot;>
<cfexecute name=&quot;#variables.strFile#&quot;
arguments=&quot;www.yahoo.com,www.tek-tips.com&quot;
timeout=&quot;10&quot;/>


[COLOR=000080]</pre>[/color]
=== END CF CODE EXAMPLE ===

One suggestion I would make, if you are dealing with modification of files in the bat file, I strongly suggest using a <CFLOCK> around the <CFEXECUTE> tag.

<cfset strFile = &quot;c:\test.bat&quot;>
<cfset LockName = ToBase64(LCase(strFile))>
<cflock name=&quot;#LockName#&quot; type=&quot;exclusive&quot;
timeout=&quot;10&quot;>

<cfexecute name=&quot;#variables.strFile#&quot;
arguments=&quot;www.yahoo.com,www.tek-tips.com&quot;
timeout=&quot;10&quot;/>

</cflock> - tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top