2007 Aug 6, 5:40
I was messing with the XSLT to XSL Converter
file that can be run with cscript.exe. I've changed it to be like a very basic version of xsltproc
that simply runs an XML file through an XSLT. I
also wanted to run this from the command prompt without writing "cscript ..." everytime. I decided to make like perl programmers I've seen and make a JS file that works as a batch file and a JS file
at the same time.
Here's a basic version of what I ended doing applied to a 'hello world' script named helloworld.cmd:
/* 2> NUL
Says 'Hello world.' when you run it.
var outText = 'Hello world.';
Running this on a command prompt gives the following:
However, after a little more experimentation I found this was slightly overkill for my purposes since if I rename the file to helloworld.js and just type its name like a command it is
run by cscript:
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
2007 Aug 3, 3:19