Skip to main content
Inspiring
July 20, 2006
Answered

cfexecute Problem

  • July 20, 2006
  • 9 replies
  • 2251 views
After reading several other posts, I've modified my cfexecute tag to launch a cmd file that launches my exe file. The problem I have is that it launches it as process in Windows. If I go Windows Task Manager, the application is running as a process, which doesn't work for me. How do I make it run as a regular application?

Running the cmd file directly kaunches the exe file as an application, as expected.
    This topic has been closed for replies.
    Correct answer jfillman
    Solved it. Launch the installer msi file from cfexecute, and you can do it. I used the CFX_EXEC custom tag.

    Thanks to Andrei for the tag and the installation idea.

    9 replies

    jfillmanAuthorCorrect answer
    Inspiring
    July 24, 2006
    Solved it. Launch the installer msi file from cfexecute, and you can do it. I used the CFX_EXEC custom tag.

    Thanks to Andrei for the tag and the installation idea.
    jfillmanAuthor
    Inspiring
    July 24, 2006
    jfillmanAuthor
    Inspiring
    July 24, 2006
    No error is generated. I clearly is not able to find or load thes session. If I remove the session from the parameters, the application loads fine.

    Here is a link to the company's product page. http://www.data-conversions.net/products.php?prod_num=7&&dest=MENU&&ID=204

    You can download a demo there if you'd like to take a look. This is a third party application that sync's MySQL to Access and vice versa.
    jfillmanAuthor
    Inspiring
    July 21, 2006
    Tried both, neither worked. The exe runs and immediately quits. Security problem?
    Participating Frequently
    July 21, 2006
    When your program exists, does it say anything? Write some log files, etc. to indicate the reason? Most common problem - it needs something, which is not allowed under the account service is using. Access network? Database? What is the nature of the program? Some program will even fail, if the working directory set incorreclty. Does it reads/writes files?
    jfillmanAuthor
    Inspiring
    July 20, 2006
    Yes, I understand that this runs on the CF server. I'm assuming that my exe and arguments are not running correctly because they are a process on the server, since I see no other reason for it not running correctly.

    It's lengthy to explain, but this is running in an Intranet environment. There are some users that need offline copies of the database, but also need to continue to use the CF application, therefore, they also have a local copy of the application and a CF Server running on their machines. I have to programatically launch a local script to sync their database up to the primary database. Relying on users to remember to launch a script to sync the db to their system, and then to sync their changes back will lead to data loss/corruption. If I programatically control when the DB's are sync'd, I prevent or dramatically minimize data issues.
    Participating Frequently
    July 21, 2006
    >I'm not quite sure you understand my issue (or maybe I don't understand what I'm asking!).

    I am sure you didn't understand my explanation (or, most likely, you don't understand what you are asking).

    The reason why you cannot see Calculator's window on the desktop (and listed, as "Application" in Task Manager) was explained in (3) in my post. You have two options (maybe there are more, but I know these two):

    1. Change the way how CF service is running.
    Go to Control Panel --> Services. Open properties of CF service. Check the box labelled "Allow Service to Interact with Desktop".
    Restart the service. Now, everything that you start with CFEXECUTE will start on the interactive desktop. For example, you can start the notepad.exe and actually type something there. Of course, nobody runs services like this, unless for debugging.

    2. Use third-party tool called CFX_EXEC.
    With this tag you can explicitly specify the target desktop. So, you can launch interactive (and visible) programs (processes), which you call "applications". The tag is available HERE.
    Participating Frequently
    July 20, 2006
    <cfexecute> executes an application on the CF server. It cannot execute an application on the client's machine. That would be a huge breach of security.

    JR
    Inspiring
    July 20, 2006
    I'm not sure about your quote problem, have you tried escaping them by
    doubling them up?

    argument=" /Sesion:""Sync"""

    Or mixing the types?

    argument=' /Session:"Sync"'

    You will never be able to launch an executable that the human user will
    see, you are not working on the user's client machine. The process you
    are launching is on the ColdFusion server machine and the user can not
    see what process the server may or may not be running. In actuality the
    "user" of the process will be the "user" of the ColdFusion service.



    jfillman wrote:
    > I'm not quite sure you understand my issue (or maybe I don't understand what
    > I'm asking!).
    >
    > Take the following example code:
    > <cfexecute name="C:\calc.exe">
    > </cfexecute>
    >
    > I copied the Windows calculator exe file to C:\. Launching it from cfexecute
    > directly or from a cmd file, launches this in a state where a users can't see
    > or use the application. In the Task Manager, it's listed as a Process. If I
    > click on the exe file, the Task Manager lists the calc.exe as BOTH a Process
    > and an Application, and the user can use the application.
    >
    > The ultimate question is, how do I launch an cmd from cfexecute that then
    > launches and exe the user can see and interact with?
    >
    > The reason I can't launch the exe directly from cfexecute is the argument I
    > need to send include quotes (""), which CF mis-interprets as the end of the
    > argument. I need to send something like this argument=" /Session:"Sync"". Note
    > the double quotes. Without sending the quotes to the application, it won't
    > launch the Session.
    >
    jfillmanAuthor
    Inspiring
    July 20, 2006
    I'm not quite sure you understand my issue (or maybe I don't understand what I'm asking!).

    Take the following example code:
    <cfexecute name="C:\calc.exe">
    </cfexecute>

    I copied the Windows calculator exe file to C:\. Launching it from cfexecute directly or from a cmd file, launches this in a state where a users can't see or use the application. In the Task Manager, it's listed as a Process. If I click on the exe file, the Task Manager lists the calc.exe as BOTH a Process and an Application, and the user can use the application.

    The ultimate question is, how do I launch an cmd from cfexecute that then launches and exe the user can see and interact with?

    The reason I can't launch the exe directly from cfexecute is the argument I need to send include quotes (""), which CF mis-interprets as the end of the argument. I need to send something like this argument=" /Session:"Sync"". Note the double quotes. Without sending the quotes to the application, it won't launch the Session.
    Participating Frequently
    July 20, 2006
    1. The use of cmd.exe (command shell) is not required, if you launch an executable. It is required, when you execute, let's say, a batch file (mybat.bat) or a DOS command (dir C:\) - something that, in fact, is not executable.

    2. Application is another word for process. "Process" is for programmers, "application" - for all others. In fact, "application" does not have even exact definition. If you look in IIS manager, all your CF stuff called there "application" also.

    3. The Windows Task Manager displays processes that run interactively (default windows station and desktop) AND create [top-level] windows in its window named "Applications". Agian, refer to (2) - why.