Inets, CGI, Python, and Windows, oh my!

Ted Shab tshab@REDACTED
Wed Feb 21 21:54:20 CET 2001


This may help:

http://support.microsoft.com/support/kb/articles/Q164/6/74.ASP?LN=EN-US&SD=gn&FR=0&qry=bat&rnk=2&src=DHCS_MSPSS_gn_SRCH&SPR=IIS

HOWTO: Use a CMD or BAT File as a CGI Script 

SUMMARY
Internet Information Server 1.0 (IIS) can use .cmd or
.bat files as CGI scripts. In IIS 2.0 and 3.0, this
capability has been removed by default. 

MORE INFORMATION
You can enable the use of .cmd and .bat files with IIS
by adding a script mapping to the registry. 

WARNING: Using Registry Editor incorrectly can cause
serious problems that may require you to reinstall
Windows. Microsoft cannot guarantee that problems
resulting from the incorrect use of Registry Editor
can be solved. Use Registry Editor at your own risk. 

For information about how to edit the registry, view
the "Changing Keys And Values" online Help topic in
Registry Editor (Regedit.exe) or the "Add and Delete
Information in the Registry" and "Edit Registry Data"
online Help topics in Regedt32.exe. Note that you
should back up the registry before you edit it. 


Start Registry Editor (Regedt32.exe) and locate the
following registry subkey in the HKEY_LOCAL_MACHINE
subtree:

     
\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Script
Map
 



On the Edit menu, click Add Value. 


Enter the following for .cmd files:

      Value Name: .CMD
      Data Type: REG_SZ
      String:
     "\Winnt\system32\cmd.exe /c %s %s" (Leave off the
quotation marks)
 
For .BAT files, repeat this process and substitute
.BAT for .CMD in the value name. 


Sample Script
Use any text editor to create the following script and
save it as myscript.cmd. 

   @echo off
   echo Content-Type: text/plain
   echo.
   echo Hello World!!
   echo.
   echo. 

The above test script can be placed in the IIS server
\scripts directory. You can run this script from the
following URL, for example: 
http://servername/scripts/myscript.cmd 

 



--- Bijan Parsia <bparsia@REDACTED> wrote:
> Or "Oh damn!" ;)
> 
> Anyone have any tips on running python cgi scripts
> under Inets under
> Windows (gag) 98?
> 
> AFAICT, it's not going to work out of the box no
> matter how I diddle the
> settings. mod_cgi:is_executable/1 seems incapable of
> recognizing *.py
> files as executables because, well, they *aren't* to
> Windows, or rather,
> to *dos* (yuck!).
> 
> (Note that os:find_executable(python) works, so the
> python executable is
> in my PATH variable.)
> 
> Even if it would find the interpereter, it's not
> clear that it will get
> any results or even execute the script. 
> 
> 	os:cmd("python tester.py").
> 
> doesn't work. It doesn't execute the script (though
> sometimes it *does*
> crash windows).
> 
> 	os:cmd("python -c \"import tester; tester.test()").
> 
> *does* work and even gets the results.
> 
> Oh the pain.
> 
> Any hints like suffering souls care to share?
> 
> Cheers,
> Bijan Parsia.
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/



More information about the erlang-questions mailing list