use strict; # Always start a Perl script with these two without them use warnings; # there are many subtle ways to shoot yourself in the foot use CGI; # Load the module to handle CGI stuff my $cgi = CGI->new(); # get a CGI object. # Point to the batfile, notice we can use / as a path separator in Perl # even when we are in a Windows world. my $batfile = 'c:/program files/mycode/batman.bat'; # I guess you are going to get the parameter from the CGI invocation my $param = $cgi->param('some_field'); # run the command and wait for it to complete. Catch STDERR my $result = `$batfile $param 2>&1`; # This probably won't work as we did not set up an http header, you may want # to use logfile, send output to the cgi invoker, or just throw it away Print "the command: $batfile $param\nGasve the result: $result";