1

This is something I only found out about today is that JavaScript can be run through a windows command line.

So I found out that to run a javascript file in windows cmd.exe you use cscript.

My hworld.js file only has one line

print('hello world');

I try to run this through the command line with

cscript /Prog/hworld.js

It didn't run with the error

Microsoft JScript runtime error: Object Expected

Are there steps i need to follow before simply cscript running a one line javascript file.

I was under the impression that JavaScript will just run out the box.

PS. Java is the development environment set up for the computer I am trying this on, installed and functional

TheLovelySausage
  • 3,838
  • 15
  • 56
  • 106
  • You may also find useful [how to combine cscript javascript code into a batch file](http://stackoverflow.com/a/29697508/1348138) – robert4 Apr 17 '15 at 11:11

1 Answers1

3

The right command to print text in the console is

WScript.echo("your text");

The rest works pretty much like javascript.

chillichief
  • 1,164
  • 12
  • 22
  • Whaaaaaaaat, I have not found any documentation on syntax differences. Is there a link where I can look for other inconsistencies when running javascript in the console? Thanks a bunch – TheLovelySausage Mar 05 '15 at 15:39