Skip to main content
November 19, 2010
Question

Cfexecute permission

  • November 19, 2010
  • 4 replies
  • 9655 views

Hi,

I am trying to run the following C:\temp\test.bat file using cfexecute

@echo off
start iexplore.exe www.google.com

<cfexecute name = "c:\temp\test.bat" timeout="1"></cfexecute>

The test.bat file opens up internet explorer when I call it from a Windows command, but the CF script does not do anything.  When I googled the problem, a couple people suggested that it might be a permission issue, ie. ColdFusion service does not run as admin in Windows. However, there is no mention of how to fix it.

My questions are:

1. Is this true that CF service does not run as admin eventhough me as the user is an admin?  I have no problem with cffile writing to C:\temp.

2.  How do I run CF service as an admin?  I use Windows Vista as my OS.

Thank you!

    This topic has been closed for replies.

    4 replies

    Inspiring
    May 19, 2018

    I know this is a bit late.

    But this his is what you are looking for:

    Adiabata, Inc. - CFX_EXEC

    BKBK
    Community Expert
    Community Expert
    November 21, 2010

    Assuming the location of the cmd.exe process in your version of Windows is c:\Windows\system32\cmd.exe, then you could try something like

    <cfexecute 
        name = "C:\Windows\system32\cmd.exe"  
        arguments="/C c:\temp\test.bat" 
        errorFile="c:\temp\test_bat_error.txt"  
        timeout="10" />

    November 22, 2010

    Hi BKBK,

    Unfortunately that doesn't work either.  Anyway, I've moved on and started the project in Visual Basic.  I guess CF is meant to be more for server apps, but it would be nice if we could build client apps like what I am trying to do.  One language for everything, and the browser as the OS.

    BKBK wrote:

    Assuming the location of the cmd.exe process in your version of Windows is c:\Windows\system32\cmd.exe, then you could try something like

    <cfexecute 
        name = "C:\Windows\system32\cmd.exe"  
        arguments="/C c:\temp\test.bat" 
        errorFile="c:\temp\test_bat_error.txt"  
        timeout="10" />

    Community Expert
    November 22, 2010

    I love CF, but it's built and designed to do exactly one thing - web applications. Not everything is a web application, and if you want to do general-purpose programming, you need a general-purpose programming language. And "the browser as the OS" would limit you to the things that a browser can do, which is a fairly small subset of what a native application can do outside a browser.

    Dave Watts, CTO, Fig Leaf Software

    http://www.figleaf.com/

    http://training.figleaf.com/

    Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on

    GSA Schedule, and provides the highest caliber vendor-authorized

    instruction at our training centers, online, or onsite.

    Read this before you post:

    http://forums.adobe.com/thread/607238

    Dave Watts, Eidolon LLC
    Inspiring
    November 20, 2010

    I am trying to run the following C:\temp\test.bat file using cfexecute

    @echo off
    start iexplore.exe www.google.com

    <cfexecute name = "c:\temp\test.bat" timeout="1"></cfexecute>

    You are aware that ColdFusion runs on the CF server, and not the client machine, yeah?  So running that batch file via <cfexecute> will just start IE on the server.

    Is that what you want?  It sounds like an odd thing to be doing.  Or is the batch file code just "for the sake of example"?

    --

    Adam

    Owainnorth
    Inspiring
    November 20, 2010

    I smell a facepalm coming...

    November 20, 2010

    Not yet, but might be soon

    Owainnorth wrote:

    I smell a facepalm coming...

    ilssac
    Inspiring
    November 19, 2010

    1) Yes, by default ColdFusion runs as "localSystem" which often does not have the required permissions to execute, access networks, etc.

    2) You configure the ColdFusion service in the windows services panel to "Log On As" a user that does have the required permissions.

    Message was edited by: ilssac  P.S. It is important to be aware that any permissions you give the ColdFusion service will be the permissions any code a hacker can trick your system to execute will run under.  So setting ColdFusion to ran as an Admin is almost never a good idea.

    November 19, 2010

    Hi ilssac, thanks for the answer.  I changed the 'Log On As' to my userid, and re-started the computer.  Unfortunately, the script above still does not work.  It just doesn't do anything.  No error message or anything.

    ilssac
    Inspiring
    November 19, 2010

    What version of CF?

    If your version suports this, are you outputing standard error?  Might give you a hint on what it going on.