• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

SCRIPT Command

I am using TCC 11.00.52 Windows XP [Version 5.1.2600], TCC Build 52 Windows XP Build 2600 Service Pack 3.

I have been using CSCRIPT within my .BTM files to execute .xbs scripts for quite some time, and all works well.

I decided today to try the internal SCRIPT command. I verified that SCRIPT is indeed an internal command by doing the following;

which script
script is an internal command
When I run the SCRIPT command by itself, it produces the following;

Seeing that the SCRIPT command recognizes the XBScript, I tried to use it in a .btm as follows;

script /E xbscript lcba.xbs
Well, that didn't work. Next, I tried

script lcba.xbs
Ditto, did not work. When I say "did not work", I mean that no output was displayed on the console, and the execution time is rapid, meaning did not work.

If I use;

cscript lcba.xbs
the script runs without any problems, reads the database, and outputs the desired results to the console.

Am I using the syntax correctly with the SCRIPT command to execute my .xbs files?

Here is a sample, test.xbs

#include "wsh.ch"

? "Welcome to XBScript"
Running this with CSCRIPT works, but not with SCRIPT.

I cannot comment on your specific issue, because I don't have XBScript in my list of script engines, but a little messing around here suggests that CSCRIPT will search the path for the given filename but SCRIPT does not. Have you tried a fully-qualified filename on your SCRIPT command??

Update: actually, I take that back. Both commands require a fully-qualified filename unless the script file is in the current directory. Ignore me.

FWIW I can get both commands to give similar results with a JScript file, so perhaps there is an issue with the XBScript engine??
After further messing around I am rather confused by what SCRIPT is actually doing. If I run a JScript or VBScript via WSH (either directly using Explorer and extension associations or via CSCRIPT) then the engine instantiates a top-level object called WScript. If I do so via the SCRIPT command then that object is called shell. Thus far I cannot find a way to write a script in either language that works in both contexts.
Top Bottom