-3

I need help! I want to start js script from cmd, i used Cscript.exe, but script does not start. After I tryed to use jrunscript, but I got error:

script error in file C:\AmdocsCRM8.1\EclipseWS\SmartClient\out\Admin\startCRM.js : sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "WScript" is not defined. (C:\AmdocsCRM8.1\EclipseWS\SmartClient\out\Admin\startCRM.js#2) in C:\AmdocsCRM8.1\EclipseWS\SmartClient\out\Admin\startCRM.js at line number 2

In script is there object WScript

var objShell = WScript.CreateObject("WScript.Shell")

My scrip strart java application, and its main task collect class path for java app, and start it. I created shortcut and start this script double click, but want to statrt it from cmd

luk2302
  • 55,258
  • 23
  • 97
  • 137

2 Answers2

2

install NodeJs https://nodejs.org/en/ and start it

node startCRM.js
frankegoesdown
  • 1,898
  • 1
  • 20
  • 38
1

You can use the NodeJS framework (https://nodejs.org/) to invoke JS on your machine. It bundles the JavaScript runner with it and you can use node command to run a JS program, or to enter a REPL.

e.g.

$ node
>> var a = 2 + 3;
   5

You can also use Chrome Headless for running server side scripts. Internally it uses Node itself.

Sid
  • 4,893
  • 14
  • 55
  • 110