CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> CodeCharge Studio -> Perl

 Executing .bat file on button click

Print topic Send  topic

Author Message

Posts: 9
Posted: 01/20/2005, 4:28 PM

I'm trying to build a button into a cgi page that will execute a bat file.
I can create the button and add Custom Code to the OnClick event. When I view the page, the button "appears" to click. But nothing happens. The batch file executes just fine from the command line or double click.
I've tried...
exec ("C:\batch.bat");
open ("C:\batch.bat");
system ("C:\batch.bat");
I'm using Win2K, IIS5, Perl 5.8.4, and CCS, permissions are WIDE open for now.
I know this is an easy fix but I'm just really new to this.

View profile  Send private message
Last Hero
Posted: 01/21/2005, 5:59 AM

exec("c:\\batch.bat") or exec('c:\batch.bat')

Posts: 9
Posted: 01/21/2005, 9:00 AM

Here's a snip of the custom code section of the file

#Custom Code @3-84ABEA10
# -------------------------
# -------------------------
#End Custom Code

I've also tried it as exec("c:\\update.bat");

No dice. Is there anything else I should try? Permissions in IIS? Anything?
View profile  Send private message

Posts: 9
Posted: 01/22/2005, 6:31 AM

I've extracted the custom code into it's own .pl file. When I execute it from the command line C:\>perl, it executes the bat file perfectly. What gives? Why can't I trigger it from a button on a cgi page?
View profile  Send private message

Posts: 9
Posted: 01/22/2005, 7:01 AM

Sorry to keep replying to my own posts.
What about "include"? do I need to include the bat file?
View profile  Send private message
Last Hero
Posted: 01/24/2005, 2:54 AM

Maybe you does not have rights?
and try this:

Posts: 9
Posted: 01/24/2005, 4:51 AM

I'm running as administrator and the file/folder permissions are "Everyone" After the above exec suggestion failed, I used the system method as well. Same result. The bat tries to execute but hangs. Access is running, I see it in task manager, but it's locked. The only way to kill it is to reboot.
I've adressed my problem by a different route though and this is no longer necessary. Thanks for the help.
View profile  Send private message
Posted: 01/24/2005, 9:59 AM

Do you mind sharing what was your final route in resolving this issue?

Posts: 9
Posted: 02/04/2005, 1:19 PM

Oh, sorry about the delay.
I changed the display queries so that as soon as the user loaded or edited new data using a grid, it would show the changes as soon as the data display page was updated. No Macro use required.
View profile  Send private message

Add new topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

Web Database

Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.