EricHoma
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\1165 91_MK131-0 01_7_20120 524234051. 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.
C:> FolderName\BatchFile .\FilestoParse\source\1165
(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.
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)
If it works, try the same with cfexecute. Again be sure all paths are absolute
<cfset pathToBatFile = ' "c:\FolderName\BatchFile .\FilestoParse\source\1165 91_MK131-0 01_7_20120 524234051. imp.bat" '>
<cfexecute name="c:\windows\system32\ cmd.exe"
arguments='/c #pathToBatFile#" ... />
Any change? If not it could be permissions.
- 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"
If it works, try the same with cfexecute. Again be sure all paths are absolute
<cfset pathToBatFile = ' "c:\FolderName\BatchFile .\FilestoParse\source\1165
<cfexecute name="c:\windows\system32\
arguments='/c #pathToBatFile#" ... />
Any change? If not it could be permissions.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad it's solved. Since you figured it out completely on your own, you should accept your comment as the answer IMO.
ASKER
Although I received a suggestion I was able to figure it out on my own.
cfexecute name = "C:\Windows\System32\cmd.e
arguments = "/c FolderName\BatchFile .\FilestoParse\source\1165