Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #35525
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2018-08-18 15:09 -0700 |
| References | <f15ab55b-562a-4005-a351-230861244b24@googlegroups.com> <XnsA942EB3CBFE8Eeejj99@194.109.6.166> |
| Message-ID | <1effe412-1e7a-4140-a805-e24e05281ca2@googlegroups.com> (permalink) |
| Subject | Re: Batch pipe JScript question |
| From | Dr J R Stockton <J.R.Stockton@physics.org> |
On Saturday, August 18, 2018 at 10:10:15 PM UTC+1, Evertjan. wrote:
> Dr J R Stockton wrote on 18 Aug 2018 in
> comp.lang.javascript:
>
> > The following XXX.BAT is to be run at the CMD.EXE command line in
> > my Windows 7 & 10. It calls the XXX.JS and they work. Windows is
> > set to ISO8601 date/time, of course.
> > ...
> What about this, John?
>
> ====== xxx.bat =========
> @echo off
> dir x*.* | cscript xxx.js
> ========================
>
> ====== xxx.js =========
> var stdin = WScript.StdIn;
> var stdout = WScript.StdOut;
> var str;
>
> while (!stdin.AtEndOfStream) {
> str = stdin.ReadLine();
> str = str.replace(/xxx/,'aaa');
> stdout.WriteLine(str);
> };
> ========================
That looks just what I want, but it's too late to install
and test it tonight.
Meanwhile, though, I have :
============
:: PLUS-DOW.BAT JRS 2018-08-18+
DIR %* | CSCRIPT \UTYS\PLUS-DOW.JS
:: END
============
// PLUS-DOW.JS Add day-of-week to output of DIR, piped
// (c) JRS 2018-08-18+
// E.G. DIR %0 | CSCRIPT \UTYS\PLUS-DOW.JS
function AddDow(match) { return match + " " +
new Date(match.replace(/-/g, "/")).toString().substring(0, 3) }
var tmp = WScript.StdIn.ReadAll()
var TEMP = tmp.replace(/(\d\d\d\d-.+:\d\d )/g, AddDow)
WScript.Echo(TEMP)
WScript.Echo("Done")
WScript.Echo("\n")
// End
============
Your way might be better for piping the output into,
for example, FIND or MiniTrue.
--
(c) John Stockton, near London, UK. Using Google Groups. |
Mail: J.R.""""""""@physics.org - or as Reply-To, if any. |
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Batch pipe JScript question Dr J R Stockton <J.R.Stockton@physics.org> - 2018-08-18 12:46 -0700
Re: Batch pipe JScript question "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-08-18 13:44 -0700
Re: Batch pipe JScript question Dr J R Stockton <J.R.Stockton@physics.org> - 2018-08-18 14:43 -0700
Re: Batch pipe JScript question "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-08-18 23:07 +0200
Re: Batch pipe JScript question Dr J R Stockton <J.R.Stockton@physics.org> - 2018-08-18 15:09 -0700
Re: Batch pipe JScript question "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-08-19 11:40 +0200
Re: Batch pipe JScript question Dr J R Stockton <J.R.Stockton@physics.org> - 2018-08-19 09:12 -0700
Re: Batch pipe JScript question "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-08-19 22:49 +0200
Re: Batch pipe JScript question Dr J R Stockton <J.R.Stockton@physics.org> - 2018-08-20 03:22 -0700
csiph-web