2007 Aug 6, 5:40
I was messing with the XSLT to XSL Converter
source which is a
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
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
So this time I didn't need all that but if ever in the future I need to run a batch file then a JS file I can do it with one file...
2007 Aug 3, 3:19