Need help with cfexecute

EricHoma
EricHoma used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
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"
Most Valuable Expert 2015

Commented:
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.
Commented:
Thanks for the suggestion but I have discovered my problem.  It has to do with paths and references to properties files that the batch file was including.  Once I modified the paths to the jar file, etc. to begin a the root (c:\) then it started working.  Thanks again for attempting to help.

Not sure what the process is here for awarding points and closing my question in this case.
Most Valuable Expert 2015

Commented:
Glad it's solved.  Since you figured it out completely on your own,  you should accept your comment as the answer IMO.

Author

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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial