Link to home
Start Free TrialLog in
Avatar of EricHoma
EricHomaFlag 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.
Avatar of MAdS
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"
Avatar of _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
Avatar of EricHoma
EricHoma
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Glad it's solved.  Since you figured it out completely on your own,  you should accept your comment as the answer IMO.
Avatar of EricHoma

ASKER

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