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.
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.
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.
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,
^_^
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!
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,
^_^
Copy link to clipboard
Copied
Supposedly, ColdFusion 12 (yet to be released) is going to add this capability....fyi
Copy link to clipboard
Copied
Good to know. Thanks!
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,
^_^
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
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.
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.
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.
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
Copy link to clipboard
Copied
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: