0
Execute .bat file using cfexecute tag...
New Here
,
/t5/coldfusion-discussions/execute-bat-file-using-cfexecute-tag/td-p/809330
Feb 16, 2009
Feb 16, 2009
Copy link to clipboard
Copied
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.
Note:- I am trying to encrypt a txt file using GPG algorithm in the batch file.
Thanks in advance!
Manju
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.
Thanks in advance!
Manju
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/execute-bat-file-using-cfexecute-tag/m-p/809331#M75050
Feb 16, 2009
Feb 16, 2009
Copy link to clipboard
Copied
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).
--
Mack
> 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).
--
Mack
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Manju82
AUTHOR
New Here
,
/t5/coldfusion-discussions/execute-bat-file-using-cfexecute-tag/m-p/809332#M75051
Feb 16, 2009
Feb 16, 2009
Copy link to clipboard
Copied
thanks for the reply mack!
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.
I dont know, something is wrong 😞
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.
I dont know, something is wrong 😞
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/execute-bat-file-using-cfexecute-tag/m-p/809333#M75052
Feb 16, 2009
Feb 16, 2009
Copy link to clipboard
Copied
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.
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
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.
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/coldfusion-discussions/execute-bat-file-using-cfexecute-tag/m-p/809334#M75053
Feb 17, 2009
Feb 17, 2009
Copy link to clipboard
Copied
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>
Regards Guy
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>
Regards Guy
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/coldfusion-discussions/execute-bat-file-using-cfexecute-tag/m-p/809335#M75054
Feb 17, 2009
Feb 17, 2009
Copy link to clipboard
Copied
I do it like this:
some code to create a file,
<cfexecute arguments="#session.filename#"
name="d:\dw\Guest Sites\kc_infogram\printme.bat">
</cfexecute>
some code to create a file,
<cfexecute arguments="#session.filename#"
name="d:\dw\Guest Sites\kc_infogram\printme.bat">
</cfexecute>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

