================================
PScript
Portable Script Host for Windows
================================

BVO Computing Services
Copyright  2011 Robert D. Riemersma, Jr

Version 1.x August 2011


INTRODUCTION

PScript was developed for use in running "portable" software in
conjunction with a launcher utility such as my own PockeTop
Portable Desktop.  Such software is typically carried from
computer to computer on a removeable medium such as a CD-ROM,
USB drive, or floppy disk.

Normally for software to run "portably" it should be written and
packaged such that it does not need to modify system state on
the host computer in order to run.  For example such programs
should not require COM registration or otherwise alter the
system registry.

Often however it can be useful to perform pre- or post-
processing around a program run.  For example the program and
its data might be stored on a USB flash memory drive but you may
wish to minimize wear on the device.  You could copy work files
to the host hard drive before running against them, then
optionally copy the altered work files back to the flash drive
after ending the program, and finally clean up the host hard
drive by deleting the work files.

Using .CMD or .BAT files for this purpose works, but can be
clunky leaving console windows open on the desktop.  Windows
Script could be an answer, but sadly in many portable software
usage scenarios such as libraries, cybercafes, and corporate
settings Windows Script Host (WSH) is disabled or locked down
for system safety reasons.


ABOUT PSCRIPT

PScript is a portable script host you can use instead of WSH's
CScript and WScript hosts.

It adds a few useful properties and methods to the bare bones
of the VBScript and JScript engines already present on the host
machine.  However PScript does not use any tricks to provide
any system access the running user would not already have, and
doesn't even offer HKCU registry manipulation.

HOST REQUIREMENTS

A host must be running Windows 98 or later with IE 5.x or later
in order to ensure that the VB6 runtime libraries and compatible
Windows Script engines are available.

Those prerequisites can be installed into Windows 95 as well,
but you can't count on them in the wild.


TESTED ON

    o Windows XP 32-bit SP 3

    o Windows Vista 32-bit SP 2

    o Windows 7 32-bit RC


DEPLOYING PSCRIPT

Copy PScript.exe anywhere you want on your portable disk medium.
Perhaps a directory named PScript.

Also copy the subdirectory PScriptBin and its contents inside
*that* directory.

You're done.

The program contains an embedded isolation and trustinfo
manifest that lets it use msscript.ocx without registering it on
host computer(s).

    NOTE:

    Source-only distributions will have none of those files or
    directories.  You will have to compile PScript yourself and
    obtain a copy of msscript.ocx to use.  This means you'll
    probably need VB6 Professional or Enterprise.

    With minor rework it may be possible to compile PScript with
    some editions of VB5.  However contemporary versions of
    Windows do not include the VB5 runtime libraries, so there
    is little point.


USING PSCRIPT

See the document PScript.rtf that should be included in the
PScript package you obtained.  Typically this is just a .ZIP
archive.

There you should find information on PScript's command line
parameters and the object model PScript exposes to provide tools
to your script for copying files and running your applications.


RECOMPILING PSCRIPT

The application manifest is already present in the project's
.RES file.  This means you can compile PScript normally in the
VB6 IDE, but afterward you should relink it for "run from CD"
which will also save wear and tear on flash memory drives.

Drag and drop PScript.exe onto the script LinkCDRun.vbs, which
you may have to modify if your VB6 instalaltion is in a non-
default location (see comments inside LinkCDRun.vbs).

You may also want to be sure to relink msscript.ocx in the
same way if you replace it from another source.

Also:

Compiling PScript to p-code should not present any important
performance concerns, and will make the EXE a bit smaller.  This
can be a good thing on media where size matters.


EXTENDING PSCRIPT

Adding more "tools" for the script to use should be fairly
straightforward.  File read/write might be useful to go further
in FSO avoidance, some registry or INI functions might be handy.

Note that the idea here was to be able to run in Least-
privileged User Account (LUA) scenarios though.  That means
limiting registry access to HKCU but it might still be of some
value.  For the same reasons I'm not sure how useful it would be
to provide path lookup for other Special Folders besides the
AppDataLocal already in there.


TESTING PSCRIPT

The source code archive should also include a VBScript named
TestSuite.vbs and a folder "test abc" that excercise the script
host.

Open a CMD.EXE window, CD to the folder containing these items,
and enter:

    pscript testsuite.vbs

This will execute the script, testing each of the methods and
properties PScript exposes.

