Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

SCRIPT Command

Aug
1,916
68
Hi,
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;

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

Code:
XML
XBScript
VBScript
VBScript.Encode
JScript
JScript.Encode
PerlScript
Seeing that the SCRIPT command recognizes the XBScript, I tried to use it in a .btm as follows;

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

Code:
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;

Code:
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

Code:
#include "wsh.ch"

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

Joe
 
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.
 

Similar threads

Back
Top