Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

executing .bat files as CGI on WIN NT 4.0

Posted on 1997-10-02
8
Medium Priority
?
533 Views
Last Modified: 2013-12-25
Dear Sir/Madam,

    I am trying to execute a bat file as a CGI script
on a WIN NT 4.0 web server. I have managed to associate
c:\%SystemRoot%\System32\cmd.exe with .bat files and
.cgi files using the registry.
   I have HTML files that I access over the Net and FORM
statements within that ACTION these .bat files.

   The result of attempting to execute this batch file
is HTTP: error 501 which in my documentation just says
"cannot assign a varable".

   I dont know how to write .bat command files that are
compatable with the web. I have written equilivent shell
scripts for UNIX ok, so I'm fairly up to speed.

   Searching the net I just find example CGI for UNIX
I cannot find example CGI .bat files for WIN NT.

   By the way my latest attempt at a .bat file looks like:

echo "Context-type: text/html"
echo ""

echo "Some Text"

Also How do I pass search queries into these .bat CGI
files? I think they are environment varables but an
example would go down a treat.

      Could any one help.

      Yours Faithfully
      Allan Wrobel

      cairs-support@cairs.co.uk
0
Comment
Question by:wrobel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 7

Expert Comment

by:faster
ID: 1830712
bat file is very limited in function, it can not be compared with unix shell script.  Why not use Perl or normal exe?
0
 

Author Comment

by:wrobel
ID: 1830713
Dear Faster,
    Thanks for replying.
I will try to use .exe files, but what is the interfase to
.exe files. Do queries come over in the argc/argv
manner? Do I just write to standard output?
Do I have to write a slightly different 'C' executable
for all the different jobs in our web space?

    Yours
    Allan Wrobel
    cairs-support@cairs.co.uk
0
 

Author Comment

by:wrobel
ID: 1830714
Dear Faster,
    I may have to persevere with .bat files.
So what is this 501 error I'm getting?
    Yours
    Allan
0
What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

 

Author Comment

by:wrobel
ID: 1830715
Do You have any example .bat's?

0
 
LVL 7

Expert Comment

by:faster
ID: 1830716
Your bat file seems to be OK, I am afraid that the error is from the configuration, I mean, probably the way to invoke bat file is not correct.

To write CGI in c/c++, you need to either read the stdin (for POST) or get the request from the env variables.  I can email you a sample program if you wish.
0
 

Author Comment

by:wrobel
ID: 1830717
Dear Faster,
    Thanks for replying.
Yes I would be very thankful for an example 'c'
program.
    I still don't understand the point about
associating a file extension with a particular handler
in NT. If an ACTION to a HTML FORM statment refers to
an .exe file that I write its that exe that I want
executed. But NT seems to require that I associate
file extensions with some handler that then executes
to process the argument to the ACTION in the FORM.
    Do I have to write a .exe hander that gets the
target .exe as a argument and then proceeds to execute
the target exe?
      Yours Rather confused
      Allan
      cairs-support@cairs.co.uk

0
 
LVL 7

Accepted Solution

by:
faster earned 880 total points
ID: 1830718
For an exe file, you need not have any kind of association.  What webser are you using?  Normally you only need to config a cgi directory and put your exe file there.  If you are using Netscape Enterprise server, the directory should be a normal CGI directory, not shell-cgi.

I will send you some parts of my cgi source code.
0
 

Author Comment

by:wrobel
ID: 1830719
Thanks for the example source.
I am running on a DELL machine Microsoft Win NT 4.0.
I have execute permission on the directory that
holds the .exe file. The FORM statment references
the correct file in the correct directory and I
still get error 501.
I have found a better description of the error
it's "The server does not support the functionality
required to fulfill the request."
Until I can solve this 501 error I am totally stuck.
     Yours
     Allan

0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question