Does Jscript on windows really exist?

  • Thread starter Thread starter oldtobor
  • Start date Start date
  • Tags Tags
    Windows
Click For Summary
SUMMARY

JScript exists on Windows and can be executed directly from the command prompt using the Windows Script Host (WSH). Users can run scripts by saving them with a .js extension and executing them with the command "cscript hello.js" for console output. The alert() function is not available in JScript, which can lead to confusion for those transitioning from VBScript. The discussion highlights the importance of using WScript methods, such as WScript.echo, to output results in JScript.

PREREQUISITES
  • Familiarity with Windows Script Host (WSH)
  • Basic understanding of JScript syntax
  • Knowledge of command line operations in Windows
  • Experience with scripting languages, particularly VBScript
NEXT STEPS
  • Research the differences between JScript and VBScript
  • Learn about Windows Script Host (WSH) and its capabilities
  • Explore the use of WScript methods for output in JScript
  • Investigate error handling in JScript scripts
USEFUL FOR

Developers and system administrators interested in automating tasks on Windows using JScript, as well as those transitioning from VBScript to JScript for scripting solutions.

oldtobor
Messages
132
Reaction score
0
does Jscript on windows really exist??

I read on various web pages that jscript can be used on windows as a scripting language directly form the DOS prompt. But I couldn't find ANY working example on the internet! even a simple alert("hello") put in a hello.js file doesn't work! It says an object is missing. Now I tried to find info on the web and after many attempts I am starting to doubt if this is just hype.

Can I really run A SIMPLE alert("www") in a hello.js file from the DOS prompt without any errors ? does this jscript thing really exist ?

(I also tried c:> cscript hello.js and others but to no avail... Thanks if anyone knows anything about this.
 
Computer science news on Phys.org
Problem is the exact case of the string WScript.

(notice the WS...)


var a=new Array(10000);

for(i=1;i<10000;i++)a="www"+i;

WScript.echo (a[4877]);

for(i=999;i<1010;i++) WScript.echo (a);


It seems that some syntax is invented just to confuse; in vbs all cases work, in js not so, maybe to discourage a newbie to use js ... and then why didn't they maintain the alert() function ?

Anyways you can use this quick and dirty programming language on any PC right off the bat, just save the program as .js and run from the command line.
or run as cscript hello.js to see results as console.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
Replies
3
Views
13K