This sounds incredibly simple to do, but I can't make it work. I have it working with awk and perl, but cmd.exe wasn't designed to be a cgi program so no matter what I do, I either get the browser downloading the file, internal server error, or I get the path of the current directory as the first line.
You HAVE to put a #! in the first line of a cgi, or you get an internal server error, but I end up with
C:\Program Files (x86)\Apache Software Foundation\Apache2.2\cgi-bin>#!c:\windows\system32\cmd.exe /c
Content-Type: text/html
<HTML><BODY>
<PRE>Your environment variables are:
</PRE></BODY></HTML>
I've tried with /c, without, any number of permutations, it always prints the current working directory first before anything, so I can't print out the content type as a header.
Anybody ever get this working? I see lots of speculation in the results google shows me, but no actual working examples.