Using Rebol Scripting with Microsofts Personal Web Server

by Jan Verhoeven, 17 July 2000

Modified: 10 April 2003

Get your copy of Rebol

Download your free copy of Rebol from the Rebol Homepage

Rebol is a portable scripting language with build-in networking. Rebol scripts are machine independent and run on virtually any major CPU/OS platform: Unix, Linux, Mac, Solaris, Windows.

The Rebol interpreter itself is only a 171kb download

This article is not about Rebol itself but about using Rebol scripts as cgi scripts with Microsoft's Personal Web Server that comes with Windows 98 and can be downloaded for Windows 95.

Register the Rebol script extension

Follow the steps below to register the Rebol .r script extension for internet services.

  1. On the Start Menu click Run.
  2. In the Open box, type regedit and click OK.
  3. Open the following registry key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC \Parameters\ScriptMap
  4. On the Edit menu, point to New, and click String Value.
  5. Name the value .r and press ENTER.
  6. Select .r, and click Modify on the Edit menu.
  7. In the Value Data box, type <the full path to rebol.exe>\rebol.exe -cs %s
    NOTE: The "%s" is case sensitive (for example, "%S" will not work).
  8. Close the Registry Editor, and restart your computer.

Do not forget to restart your computer to make sure that the PWS maps the .r extension to Rebol. It may be sufficient to completely stop PWS and then restart it but I prefer restarting the comouter. You only have to do it once anyway.

Run your first Rebol script.

Open notepad type the following text and save it as myrebol.r in c:\Inetpub\wwwroot\cgi-bin.

REBOL [
      ]

 print "Content-Type: text/html^/"
    either exists? %counter.total [
        count: load %counter.total] [
        count: 0]
    count: count + 1
    print [
        <HTML><TITLE>"Web Counter -- You are number" count </TITLE>
        <BODY>
        "Congratulations!  Only"
            <B> 1000000 - count </B>  "more visits until 1 million!!"
        </BODY>
        </HTML>
    ]
    save %counter.total count

Now make sure that PWS is running, open your browser and navigate to:
http://localhost/cgi-bin/myrebol.r