I am trying to execute a batch file using cfexecute tag. This
batch file needs 1 command line arguement, which I am passing using
arguments
Text attribute.
When I run my batch file directly from command prompt, it
works perfectly. but while using cfexecute, it doesn't seem to do
anything.
Note:- I am trying to encrypt a txt file using GPG algorithm
in the batch file.
Manju82 wrote:
> Hello,
>
> I am trying to execute a batch file using cfexecute tag.
This batch file needs
> 1 command line arguement, which I am passing using
arguments
Text > attribute.
>
> When I run my batch file directly from command prompt,
it works perfectly. but
> while using cfexecute, it doesn't seem to do anything.
You'll need to run cmd.exe with the bat file as your first
argument and
using the /c switch on cmd.exe if I remember correctly (the
command like
would look something like this: cmd.exe /c your_bat_file.bat
your other
arguments).
I tried openeing only cmd.exe i.e. I tried the below
<cfexecute name = "cmd.exe" timeout = "20">
</cfexecute>
But it just times out :(
Also there is no process running in the backgroud, I checked
it in the task manager.
you do not need to call cmd.exe to execute a .bat file.
you must, though, provide a full absolute filepath to the
.bat file,
even if it is in the same dir as the calling page.
also, if you are calling any other executables inside your
.bat file,
you must call them with a full filepath to the executable.
Hello,
you have probally worked this out but if any of this helps :)
I run an application that needs to print via dos command, so
my cfm page makes a batch file writes some arguments to it then
calls it with a cmd. the code is below if any of it helps im glad.
(creates name for my bat file)
<cfset BFname = '#namevariable#' & '.bat'>
(sets up the text I need in the bat file)
<cfset content = 'copy
"c:\inetpub\wwwroot\mct\picklist.txt"
\\MyPrintServer\ThePrinter'>
(writes the bat file with the text in the content var)
<cffile action="write"
file="c:\inetpub\wwwroot\mct\#BFname#" output="#content#">
(calls cmd to run the bat file)
<cfexecute name="c:\windows\system32\cmd.exe"
arguments="/c c:\inetpub\wwwroot\mct\#BFname#"
outputfile="c:\inetpub\wwwroot\mct\log_output.txt"
timeout="1"></cfexecute>