• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Cfexecute permission

Explorer ,
Nov 19, 2010 Nov 19, 2010

Copy link to clipboard

Copied

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!

Views

8.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 19, 2010 Nov 19, 2010

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 19, 2010 Nov 19, 2010

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 19, 2010 Nov 19, 2010

Copy link to clipboard

Copied

What version of CF?

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 20, 2010 Nov 20, 2010

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 20, 2010 Nov 20, 2010

Copy link to clipboard

Copied

I smell a facepalm coming...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 20, 2010 Nov 20, 2010

Copy link to clipboard

Copied

Not yet, but might be soon

Owainnorth wrote:

I smell a facepalm coming...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 20, 2010 Nov 20, 2010

Copy link to clipboard

Copied

Yes, that is what I want (I just want to run it on my own machine that runs ColdFusion developer version.)  And yes, that is an example only.  The gist of the problem is how do I get a CF script (with appropriate permission settings) to open up another application.

I am still not successful even after I played around with the permission settings.  Starting to wonder if it's even possible.

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"?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 20, 2010 Nov 20, 2010

Copy link to clipboard

Copied

I see.  I think you need to change your expectations here.  CF is not running in the GUI shell you're looking at at the moment, it's running as a service.  If it's got sufficient permissions, it can as the OS to execute [stuff], but it's still not going to show up in YOUR shell.  It'll be running in a different one.

If you check your running processes, you'll probably see IE is actually running.

Running your code on Win Vista Home Prem - having given the local account perms to interact with the desktop, I do get another shell firing off, and there's IE running.

What are you actually trying to achieve here?  It sounds like you're trying to

drive a round walnut through a square hole with a sledgehammer.  To mix metaphors.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 20, 2010 Nov 20, 2010

Copy link to clipboard

Copied

Hi Adam,

Thanks.  I am experimenting with creating a client program that runs off CF in my local machine that pulls data from our server and pass it on to our shipping program (to create shipping labels.)  I realize that there are better ways doing this (like building a proper windows client application), but I just wanted to see if this can be done using CF.

What are you actually trying to achieve here?  It sounds like you're trying to

drive a round walnut through a square hole with a sledgehammer.  To mix metaphors.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 20, 2010 Nov 20, 2010

Copy link to clipboard

Copied

There might be other ways of communicating with the shipping program? Is it a client-server thing, or just a client? Can CF hook into its DB, either via an API call or connecting to it via a DSN?

You might be constrained by what options you have, but I don't think getting CF (a server app) to talk to a client app directly is gonna be viable.

But there might be other approaches...

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 20, 2010 Nov 20, 2010

Copy link to clipboard

Copied

Unfortunately we have to communicate through the client.  They do have a  web service api but last I checked it was $0.50 per label and we didn't  want to pay that.

Would love to see if there are other options using CF, but for now I am brushing up on my Visual Basic.

Adam Cameron. wrote:

There might be other ways of communicating with the shipping program? Is it a client-server thing, or just a client? Can CF hook into its DB, either via an API call or connecting to it via a DSN?

You might be constrained by what options you have, but I don't think getting CF (a server app) to talk to a client app directly is gonna be viable.

But there might be other approaches...

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 21, 2010 Nov 21, 2010

Copy link to clipboard

Copied

I'd suggest in this case that as the OP has suggested they know VB that it would simply be a big old waste of time trying to get CF to do this; in the same way I wouldn't expect my ironing board to drive me to work CF is clearly not the right tool for the job here.

I think you're absolutely right , time to crack out Visual Studio

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 20, 2010 Nov 20, 2010

Copy link to clipboard

Copied

What exactly does this client program do? Does the client program already exist?

Although it doesn't happen by default, in some cases it's possible for a Windows service to interact with the desktop (even if it's running as SYSTEM). I just mentioned that briefly in another response in this thread, but basically you want to enable the "interact with desktop" option for that service if it exists.

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 20, 2010 Nov 20, 2010

Copy link to clipboard

Copied

Actually, depending on the version of Windows (among other things) it is possible for a Windows service to interact with the user's desktop. Google "Windows service interact with desktop" for more information. I've used this in the past to circumvent local restrictions on developer machines that happen to have CF installed.

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 20, 2010 Nov 20, 2010

Copy link to clipboard

Copied

CF doesn't run in a context that will open visible application windows on the server, by default. So even if it did run, you wouldn't be able to see it.

Can I ask what you're trying to accomplish?

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 21, 2010 Nov 21, 2010

Copy link to clipboard

Copied

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" />

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 22, 2010 Nov 22, 2010

Copy link to clipboard

Copied

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" />

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 22, 2010 Nov 22, 2010

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 22, 2010 Nov 22, 2010

Copy link to clipboard

Copied

OR

You need to go beyond the traditional 'browser' as client and use clients that are more aware of the OS they are running on.  From Adobe that would be using their AIR, flash based, client technology.  Adobe is positioning AIR to make easy use of ColdFusion as the backend server layer.  But in this situation, ColdFuion stops concerning itself with user interface generation and concentrates on being a middle tier broker connecting an AIR user interface with backend databases and other resources.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 19, 2018 May 19, 2018

Copy link to clipboard

Copied

LATEST

I know this is a bit late.

But this his is what you are looking for:

Adiabata, Inc. - CFX_EXEC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation