Avatar of EricHoma
EricHoma
Flag for United States of America asked on

Need help with cfexecute

I'm struggling with Cold Fusion cfexecute.  The server is Windows 2003 server with Cold Fusion MX 7.  I'm able to run the batch file from the command prompt on the server and it works fine.  When running on the command line (DOS Prompt) I enter it like this:

C:> FolderName\BatchFile .\FilestoParse\source\116591_MK131-001_7_20120524234051.imp

(There is a space between the executable batch file name and the path to the file to be processed.  The suffix .bat is not required from the command line although I read it might be required using cfexecute.)

I've tried to get it to run using cfexecute and I'm sure it is just a syntax issue.  Not sure if the path and file should be in the "argument" or part of the "name".  I've tried numerous combinations, with and without .bat, etc.......  Any help would be greatly appreciated.
ColdFusion LanguageWindows BatchWeb Development

Avatar of undefined
Last Comment
EricHoma

8/22/2022 - Mon
MAdS

I dont have Cold Fusion but I'd suggest the following:
cfexecute    name = "C:\Windows\System32\cmd.exe"
    arguments = "/c FolderName\BatchFile .\FilestoParse\source\116591_MK131-001_7_20120524234051.imp"
_agx_

Very close, but a couple tips to avoid common problems.

- Make sure all your paths are absolute  
- If any of the paths contain spaces, they must enclosed in double quotes
- You must include the .bat extension

Try it from the command line with those fixes. Not sure I have the correct path, but something like this (note the quotes and .bat extension)

c:>  "c:\FolderName\BatchFile .\FilestoParse\source\116591_MK131-001_7_20120524234051.imp.bat"  

Open in new window


If it works, try the same with cfexecute. Again be sure all paths are absolute

    <cfset pathToBatFile = '  "c:\FolderName\BatchFile .\FilestoParse\source\116591_MK131-001_7_20120524234051.imp.bat" '>
    <cfexecute name="c:\windows\system32\cmd.exe"
                arguments='/c #pathToBatFile#" ... />

Any change?  If not it could be permissions.
ASKER CERTIFIED SOLUTION
EricHoma

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
_agx_

Glad it's solved.  Since you figured it out completely on your own,  you should accept your comment as the answer IMO.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
EricHoma

ASKER
Although I received a suggestion I was able to figure it out on my own.