Skip to main content
Inspiring
December 23, 2015
Question

How to run a .CFM from command prompt?

  • December 23, 2015
  • 4 replies
  • 7525 views

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.

This topic has been closed for replies.

4 replies

BKBK
Community Expert
January 3, 2016

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.

-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:

Known Participant
December 29, 2015

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

Participating Frequently
December 28, 2015

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

WolfShade
Brainiac
December 23, 2015

.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.

benhennyAuthor
Inspiring
December 23, 2015

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.

WolfShade
Brainiac
December 23, 2015

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,

^_^