5.2 If a Command Won't Run
Some
commands in this chapter such
as eventquery.vbs or
prncnfg.vbs are actually admin scripts written in
VBScript. The first time you try to run one of these scripts from the
command line, you will see the following message:
This script should be executed from the command prompt using CSCRIPT.EXE.
For example: CSCRIPT %windir%\System32\EVENTQUERY.vbs <arguments>
To set CScript as the default application to run .vbs files, run the
following: CSCRIPT //H:CSCRIPT //S
You can then run %windir%\System32\EVENTQUERY.vbs <arguments> without
preceding the script with CSCRIPT.
This message is displayed because there are actually two versions of
the Windows Script Host:
- WSCRIPT
The Windows-based
version that provides a properties sheet for configuring how your
script will run.- CSCRIPT
The command-line
version that uses switches to configure script properties.
By default, WS2003 uses WSCRIPT as its default script host, but the
scripts in this chapter require CSCRIPT instead, so you can either
use CSCRIPT each time you want to run one of these scripts, like
this:
cscript eventquery.vbs
omitting "%windir%\System32\" since
eventquery.vbs is already in the system path, or
you can type:
cscript //h:cscript //s
to change the default script host from WSCRIPT to CSCRIPT, after
which you can then run the script simply by typing its filename, like
this:
eventquery.vbs
If this applies to a particular command in this chapter, the
"Notes" section reiterates this
information for your convenience.