rssval.jsb Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. Input Error: There is no script engine for file extension ".jsb". I even tried using the //E:cscript option mentioned here, but I still get an error: CScript Error: Can't find script engine "cscript" for script "C:\njt\swtech\thea rchitect\data\rss-spec\rssval.jsb". I can't seem to concoct a set of command line arguments to run a script file of this new extension, regardless of whether or not I have registered the file type. Anyone got any suggestions? In any case, what I _really_ want to happen is for a javascript file to run in batch more when run from a command shell, and in GUI mode if run from the Windows Explorer. Maybe it's just going to be easier to remember to list the script engine explicitly on the command line: cscript.exe rssval.js ' />
Windows now has some pretty good scripting facilities built in, and I have started using these more extensively recently. Using some simple code, it is possible to do some complex system admin tasks fairly easily. It can even run scripts remotely, which can be very useful for a sysadmin.
One thing that I wanted to do though was always run a certain script in command line "batch mode" rather than using a GUI. The Windows JavaScript engine does different things when displaying messages depending on whether it is running in the command-line engine (CScript.exe) or the GUI engine (WScript.exe), and I always wanted to see the output in the console window rather than in a pop-up dialog.
What I want to be able to do is have a file containing JavaScript code which will always execute using CScript.exe - ie always run in batch mode when started from a command shell.
My first thought was to register a new file extension and link it with the CScript.exe program, so I entered the following commands in a Windows CMD window:
ASSOC .jsb=JSBatchFile
FTYPE JSBatchFile=C:\WIN2000\System32\CScript.exe "%1" %*
This produced the following setup which seemed to be what I wanted, compared to the original .js settings.
That doesn't seem to be enough though - I get the following message when I use this new file type:
C:\>rssval.jsb
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
Input Error: There is no script engine for file extension ".jsb".
I even tried using the //E:cscript option mentioned here, but I still get an error:
CScript Error: Can't find script engine "cscript" for script "C:\njt\swtech\thea
rchitect\data\rss-spec\rssval.jsb".
I can't seem to concoct a set of command line arguments to run a script file of this new extension, regardless of whether or not I have registered the file type.
Anyone got any suggestions?
In any case, what I _really_ want to happen is for a javascript file to run in batch more when run from a command shell, and in GUI mode if run from the Windows Explorer.
Maybe it's just going to be easier to remember to list the script engine explicitly on the command line:
cscript.exe rssval.js
All content is
Copyright (c) 2010 Jorgen Thelin. All rights reserved.
The opinions expressed here represent my own views
and not necessarily those of my current, prior or future employer(s).
Content is provided "as-is", without any representations or warrenties of any kind.
Contents of the Weblog Feed are
licensed under a
Creative Commons License.