Scrit: A vbscript execution utility

M. Gallant 08/11/2002

Scrit.exe is a win32 exe console application which uses the Windows Script Control COM component (ProgID:"MSScriptControl.ScriptControl") to directly execute lines of vbscript specified either in the command-line string, or entered as console input after the application has started. The application is written in Java and is converted to a win32 exe file with jexegen.exe using the MS SDK for Java 4.0. Thus, it requires the MV JVM (included with IE4+ for Win95 - Win2000). The application can be launched directly by double-clicking, or started from a console window. The command-line can be specified two different ways: [Note: Escaping special characters is only required for the initial command-line string, if used.]

Generic command-line invocation:
      scrit <some valid multi-line vbscript statements>
      scrit "<some valid multi-line vbscript statements>"

Multi-line statements and escaping characters:
      scrit pi=4*Atn(1) : MsgBox "Pi: " ^& pi
      scrit "pi=4*Atn(1) : MsgBox \"Pi: \" & pi"
      scrit j=7: If j^>5 Then: MsgBox "Simple Math" : End If
      scrit "j=7: If j>5 Then: MsgBox \"Simple Math\" : End If"

Multiple statements with looping:
      scrit MsgBox "calculating ...." : for i=1 TO 1000: i=i*Sqr(i) : Next : MsgBox i, vbInformation, "Scrit"

Special characters within strings:
      scrit MsgBox "test < > || ^ &"

The Java application uses J/Direct to get the entire command string using the kernel32.dll function GetCommandLine(). The Java class ActiveXComponent is used to instantiate the ScriptControl class, initialize it and execute the vbscript statements with the AddCode() method. Since the script is not reset, defined variables can be used subsequently, for example as a continuous calculator.

Download scrit.exe

Scrit source code