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

How to run a .CFM from command prompt?

Explorer ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

I'd like to be able to run a .CFM file from a DOS Command Prompt window. Is there an EXE that I can use to do that?

Thanks.

Views

5.8K

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 ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

.CFM files are not "executable" files.  They are a scripted file that provides instructions to a CF server and require a run-time engine - that's what the browser is:  IE, FireFox, Chrome, etc, are all "run-time engines" for the scripts to parse after the CF server has generated the on-the-fly HTML and sent it to the user client.

May I ask what you had in mind regarding running something from a DOS prompt?

V/r,

^_^

EDIT:  Part of what I described isn't accurate.  The scripts aren't parsing anything.  They tell the CF server how to generate the on-the-fly HTML and the _browser_ does the parsing.  Sorry.  I was in a hurry when I typed that.

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 ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

Hi, I know they aren't executable. Is there an executable that will run them? For PHP, you can run something like:

cd c:\myphplocation\bin\

PHP myfile.php

It will become part of a batch file.

Thanks.

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 ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

Hi, benhenny‌,

AFAIK, there is no way to run any .CFM file from any kind of CLI, _however_, .CFM files can be run from the CFAdmin "Scheduled Tasks".

HTH,

^_^

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 ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

I think you're right - I haven't found any way to do it other than with a Scheduled Task.

Thanks!

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 ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

I just noticed that there are third-party scripts that can allow this, or at least an emulation of it.

HOWEVER, I would advise against using such things in a production environment. 

I think the phrase to remember is, "DANGER, WILL ROBINSON!  DANGER!"  Running something like this in production would just be like giving a burglar the keys to your house.

V/r,

^_^

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
Engaged ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

Supposedly, ColdFusion 12 (yet to be released) is going to add this capability....fyi

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 ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

Good to know. Thanks!

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 ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

That just gave me a very uncomfortable chill.

If this is true, I sincerely hope that Adobe will guard the you-know-what out of it.  This just opens another vector of attack.

V/r,

^_^

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
Engaged ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

Apparently they talked about it at CFCamp.

Blog about it here:

Adam Cameron's Dev Blog: ColdFusion 2016: the long-awaited CLI

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 ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

Lucee (an open-source CFML engine) has CLI capability, and CommandBox (CLI/REPL/Package Manager for CFML) includes Lucee in the installation.

-Carl V.

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 ,
Dec 23, 2015 Dec 23, 2015

Copy link to clipboard

Copied

I don't see the security risks, since a hacker would need to gain access to the command prompt before doing anything - and if that's the case, a command line CF is the least of your troubles.

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
Engaged ,
Dec 28, 2015 Dec 28, 2015

Copy link to clipboard

Copied

A simple java app could act as a proxy using the WebClient class.  You could also look at using HtmlUnit.   

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 Beginner ,
Dec 29, 2015 Dec 29, 2015

Copy link to clipboard

Copied

It's not impossible - it's easy to do...

Install Cygwin‌ or check out this page: Wget for Windows

Run wget Command e.g.: 😆 wget http://localhost/somefile.cfm


Works great for batch processing outside the coldfusion servlet context

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 ,
Jan 03, 2016 Jan 03, 2016

Copy link to clipboard

Copied

LATEST

benhenny wrote:

I'd like to be able to run a .CFM file from a DOS Command Prompt window. Is there an EXE that I can use to do that?

Yes, there is: Httrack. It is an off-line browser, similar in functionality to SemperVI's suggestion Wget.

But I must confess something. Technically speaking, Wget and Httrack only browse the URL to the CFM page, whereas ColdFusion actually runs it. WolfShade, Sdsinc_pmascari and Carl have explained this further.

If results are what you are after, then Httrack will give you more besides. It will give you a copy of the result of browsing the URL to the CFM page, including all the files relating to the CFM page, such as cookies, images, Javascript, CSS and so on.

In the following example, I used Httrack's command-line options to browse the page C:\ColdFusion11\cfusion\wwwroot\workspace\httrack_sites\cfforum\testPage.cfm on my local machine. I configured Httrack to output the result to the directory C:\websiteCopy.

CLI_browse_cfm_using_httrack.png

-O stands for output location, where you want Httrack to store the result;

-v stands for verbose, which instructs Httrack to include in the output any messages it may have.

The result was:

CLI_browse_cfm_using_httrack_output.png

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