By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,480 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,480 IT Pros & Developers. It's quick & easy.

Use of javascript/Jscript at Win32 DOS prompt

P: n/a

The following DOS prompt command line, in a Win98 DOS box,

cscript //nologo ~tmp.js

executes file ~tmp.js as javascript/Jscript.
The following batch file, similarly run, executes the same.

@echo off
echo WScript.Echo(new Date().toUTCString()); > ~tmp.js
cscript //nologo ~tmp.js | STOW GMT
del ~tmp.js

( STOW is a program of mine; the (first line of the) standard output of
cscript is stored in environment variable GMT, in DOS..Win98/ME but
not NT-type systems. )
Such scripts are presumably on-topic here. They will differ from Web-
type scripts in the matter of I/O and controls. They add features to
batch file use, because javascript can do much more than pure Batch; it
can, for example, get GMT.
(a) ISTM worth mentioning this in the FAQ, as it opens a door that might
not previously have been noticed and which has much on the other side.

(b) What is there to say about differences of DOM-type? Differences in
I/O? Use of wscript?

(c) Are any good references known, dealing with the above and not too
much else?

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; Win98.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.
Jul 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a


Dr John Stockton wrote:
The following DOS prompt command line, in a Win98 DOS box,

cscript //nologo ~tmp.js

executes file ~tmp.js as javascript/Jscript.
You do not even need the command line, double clicking the file should
run it with wscript.
And of course Windows Script Host for some years now also has some XML
format for .wsf files which allow you to include different library files
etc.
Such scripts are presumably on-topic here.
I don't mind anyone asking questions about JScript programs for Windows
Script Host here but I think that groups like
microsoft.public.scripting.wsh
provide more expertise on Windows Script host. Admittedly WSH groups
postings are more often dealing with VBScript programming than JScript
programming but the object model is the same. And there are jscript
scripting groups on the Microsoft server that deal with Windows Script
Host programming too.

(a) ISTM worth mentioning this in the FAQ, as it opens a door that might
not previously have been noticed and which has much on the other side.
Windows Script Host is mentioned in the FAQ as one of the common hosts.
The HTML version of the FAQ is even created by a .wsf file.

(c) Are any good references known, dealing with the above and not too
much else?


Well, the MS scripting documentation documents the Windows Script Host
object model, file format etc:
http://msdn.microsoft.com/library/de...ist/webdev.asp

Of course that is not all that is possible, once you are outside of the
security restrictions of the browser you can instantiate everything from
ADODB objects for doing data base stuff to Word.Application and script it.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

P: n/a
JRS: In article <3f********@olaf.komtel.net>, seen in
news:comp.lang.javascript, Martin Honnen <ma*******@yahoo.de> posted at
Sun, 21 Dec 2003 19:41:43 :-
Dr John Stockton wrote:
The following DOS prompt command line, in a Win98 DOS box,

cscript //nologo ~tmp.js

executes file ~tmp.js as javascript/Jscript.
You do not even need the command line, double clicking the file should
run it with wscript.


Not when working at a DOS prompt. I had in mind including that in a DOS
batch file, as I showed below.

And of course Windows Script Host for some years now also has some XML
format for .wsf files which allow you to include different library files
etc.
Such scripts are presumably on-topic here.


I don't mind anyone asking questions about JScript programs for Windows
Script Host here but I think that groups like
microsoft.public.scripting.wsh
provide more expertise on Windows Script host. Admittedly WSH groups
postings are more often dealing with VBScript programming than JScript
programming but the object model is the same. And there are jscript
scripting groups on the Microsoft server that deal with Windows Script
Host programming too.


AFAICS, they in practice refer at least predominantly and AFAIR almost
wholly to VBscript (when using WSH) or to use in Web pages.

(a) ISTM worth mentioning this in the FAQ, as it opens a door that might
not previously have been noticed and which has much on the other side.


Windows Script Host is mentioned in the FAQ as one of the common hosts.
The HTML version of the FAQ is even created by a .wsf file.


Mentioned rather in passing, though, and unlikely to be noticed by the
unaware.

(c) Are any good references known, dealing with the above and not too
much else?


Well, the MS scripting documentation documents the Windows Script Host
object model, file format etc:
http://msdn.microsoft.com/library/de...ist/webdev.asp


MS references are rarely good for those with an intermittent Net
connection. They have rather few information bits per byte transferred.
I believe that an entry in Section 4 of the FAQ would be worthwhile;
just illustrating starting javascript-in-WSH from the command line and
from, say, File Manager & Internet Explorer, and giving a well-chosen
link or two.

It could include
<script type="text/javascript" src="include1.js"></script>
&
<script type="text/javascript">
...
</script><noscript> ... </noscript>
- they may be strictly HTML, but they are important to Web use of
javascript, and often given wrongly in the group.

Perhaps a possible <FAQENTRY> could be composed here, if Jim would like
to use such.


The FAQ has not been updated lately, and new expertise has come into the
group. Might it be worth jointly reviewing one numbered part here each
week, starting I suggest at 3.1 and working round to 2.12 then 3.1
again?

Re 3.1 - I find the Pocket Reference Flanagan very useful; it is cheaper
& smaller.

Re 3.2 - Nothing to say about the intent, but I'd prefer <p> instead of
<BR> before each subsubsection.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 20 '05 #3

P: n/a


Dr John Stockton wrote:
JRS: In article <3f********@olaf.komtel.net>, seen in
news:comp.lang.javascript, Martin Honnen <ma*******@yahoo.de> posted at
Sun, 21 Dec 2003 19:41:43 :-

Dr John Stockton wrote:
(c) Are any good references known, dealing with the above and not too
much else?


Well, the MS scripting documentation documents the Windows Script Host
object model, file format etc:
http://msdn.microsoft.com/library/de...ist/webdev.asp

MS references are rarely good for those with an intermittent Net
connection. They have rather few information bits per byte transferred.


You can download the docs at the posted link, no need to visit them online.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #4

P: n/a
On Sun, 21 Dec 2003 19:41:43 +0100, Martin Honnen <ma*******@yahoo.de>
wrote:
(c) Are any good references known, dealing with the above and not too
much else?


Well, the MS scripting documentation documents the Windows Script Host
object model, file format etc:
http://msdn.microsoft.com/library/de...ist/webdev.asp


Also from the FAQ, and not worth duplicating the info of:

Sites focused on using Scripting to automate Windows:
http://www.windows-script.com/
http://cwashington.netreach.net/

Although it may be worth while altering the text along with those
urls.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #5

P: n/a
JRS: In article <3f***************@news.cis.dfn.de>, seen in
news:comp.lang.javascript, Jim Ley <ji*@jibbering.com> posted at Tue, 23
Dec 2003 12:51:06 :-
Also from the FAQ, and not worth duplicating the info of:

Sites focused on using Scripting to automate Windows:
http://www.windows-script.com/
http://cwashington.netreach.net/

Although it may be worth while altering the text along with those
urls.


Thanks, I will look at those. Yes, the words could be changed; much of
the time, I consider Windows as merely an environment for running
several DOS boxes in and for providing better-looking editors.

Presuming applicable, something with the words MSDOS & Batch might be
added?

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
HOLS.HTM <--> HOLIDAYS.HTM JS-VALID READS USER RULES (demo; w. eval)
Jul 20 '05 #6

P: n/a
JRS: In article <0i**************@merlyn.demon.co.uk>, seen in
news:comp.lang.javascript, Dr John Stockton <sp**@merlyn.demon.co.uk>
posted at Tue, 23 Dec 2003 20:06:09 :-
JRS: In article <3f***************@news.cis.dfn.de>, seen in
news:comp.lang.javascript, Jim Ley <ji*@jibbering.com> posted at Tue, 23
Dec 2003 12:51:06 :-
Also from the FAQ, and not worth duplicating the info of:

Sites focused on using Scripting to automate Windows:
http://www.windows-script.com/
http://cwashington.netreach.net/

Although it may be worth while altering the text along with those
urls.


Thanks, I will look at those. Yes, the words could be changed; much of
the time, I consider Windows as merely an environment for running
several DOS boxes in and for providing better-looking editors.

Presuming applicable, something with the words MSDOS & Batch might be
added?


One is a Microsoft site, (now?) masquerading under a false identity; the
other is a sort of newsgroup, and very slow. Neither is what I would
like to find under that heading, although it is certainly a valid
description of that pair.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 20 '05 #7

P: n/a
Martin Honnen wrote:
Dr John Stockton wrote:
[...] Martin Honnen <ma*******@yahoo.de> wrote:
Well, the MS scripting documentation documents the Windows Script Host
object model, file format etc:
http://msdn.microsoft.com/library/de...ist/webdev.asp
MS references are rarely good for those with an intermittent Net
connection. They have rather few information bits per byte transferred.


You can download the docs at the posted link,


Alas, you cannot.

| Microsoft Windows Script 5.6 Documentation
|
<http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en>
| This download provides extensive reference and conceptual
| documentation for all of Microsoft Windows Script Technologies.
| Date: September 12, 2001

Following the link results in:

| RTSP/1.0 400 Bad Request
| Server: QTSS-Akamai/4.1 (Build/412.16; Platform/Linux)
| Cseq:
| Connection: Close

Reproducible.
no need to visit them online.


I would be glad if it were the case.
PointedEars
Jul 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.