Whatever message this page gives is out now! Go check it out!
<cfscript>
//login
createObject("component","cfide.adminapi.administrator").login("admin");
myObj = createObject("component","cfide.adminapi.debugging");
returnValue = myObj.getIPList();
myObj.setIP("10.10.10.10");
myObj.setIP("22.22.22.22");
returnValue = myObj.getIPList();
if( listcontains(returnValue,"10.10.10.10",",") GT 0 AND listcontains(returnValue,"22.22.22.22",",") GT 0)
{
writeOutput("IP's added" & " ");
}
myObj.deleteIP("10.10.10.10");
myObj.deleteIP("22.22.22.22");
returnValue = myObj.getIPList();
if( listcontains(returnValue,"10.10.10.10",",") EQ 0 AND listcontains(returnValue,"22.22.22.22",",") EQ 0)
{
writeOutput("IP's deleted");
}
</cfscript>cf.bat/cf.sh without any arguments. If you open the console in REPL mode, it does the job of CLI as well now. You can specify the path of a cfm in REPL mode and execute it. Like CLI, this also handles both positional and named arguments to the cfm .cf-cli>C:\ColdFusion\cfusion\wwwroot\run.cfm arg1 arg2function add() { in the REPL mode and press Enter, it will automatically go to the next line and wait for the next line of input in the console.function add()’ and ‘{‘ in the next line, you have to type as the line as function add() ^.multilineexit .cf-cli>x=11cf-cli>if (x==1) ^...writeOutput("Hello ColdFusion") cfm files can either be in wwwroot or in a different location.cli.getArgs() - Gets all the arguments.cli.getNamedArgs() - Gets all the named arguments.cli.getUnnamedArgs() - Returns all the unnamed args as a CFML array or an empty array if none are specified.cli.getArg(int index) - Gets the argument at the index location.cli.getNamedArg(String argName) - Gets the value of the named argument with name argName.outputdir and logdir while executing the cfm. By default, both classes and logs go to the temp folder.cf.bat cliscript.cfm –outputdir=c:\cfclasses –logdir=c:\logsonApplicationStart(), onApplicationStop(), and onError() methods are supported. There is no support for session and request methods in CLI. stdin and stdout/stderr: cli .read() - Reads one line from stdin.cli.writeln(message) - Writes the message string to stdout.cli.writeError(errorMessage) - Writes the error message string to stderr. cli .exit(exitCode) - The exit function takes an optional status code and exits to the console with the specified exit code. By default, CLI returns an exitcode of 0 on successful execution and 1 when execution fails.enablecfoutputonly is set to true.readwrite.cfm
<cfset CLI.writeError("This is an error message from CLI writeError!")>
<cfset CLI.writeln("This is CLI write method!")>cf.bat readwrite.cfm >> c:\logFile.txt 2>> c:\errFile.txtcli.exit(exitCode) - The exit function takes a status code and exits to the command prompt with the specified exit code.