I am having a problem with both cfexecute and CFX_EXEC in
that they seem to launch an application as a process and work in
the background, but I cannot get it to launch on the desktop as an
application. This wouldn't be a problem as it actually seems to
execute a single command very well. The problem I am having is when
I try to launch a multi-step batch file or when I need to receive
feedback from the launched application it fails.
I have a batch file which basically calls an application
called imacros and depending on the outcome writes the results to
mysql database. See attached code.
When I execute a batch file by double clicking it the CMD
window opens and runs through the entire batch file perfectly.
However when I execute the same batch file with cfexecute or
cfx_exec the process only launches the first command, launching
imacros and completes it's objective. However the process seems to
terminate after that and thus nothing gets written to mysql.
I assume that this has to be a setting in Windows 2003 or a
permissions issue that is not allowing me to run applications on
the desktop. I have set Coldfusion to run as Administrator but this
hasn't helped. I also have tried to assign it as System user and
allow it to interact with desktop.
It is very unlikely that this is a desktop problem. You can
easily verify that in CFX_EXEC using INTERACTIVE option.
Most likely this is the problem with conditions in your batch
file, which are not correctly processed due to using "alien"
launchers (CFEXECUTE and CFX_EXEC).
Immediate suggestion is not to use the batch file at all, but
use conditional CFX_EXEC. CFX_EXEC returns the process return code,
which you might be able to use for recognizing the error condition,
if "imacros.exe" sets it properly. So, just analyze process return
code and launch second CFX_EXEC or CFXEXECUTE to run the
appropriate second command.