473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Use of javascript/Jscript at Win32 DOS prompt


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
7 2872


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


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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.