Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
74
rated 0 times [  76] [ 2]  / answers: 1 / hits: 64791  / 12 Years ago, tue, august 21, 2012, 12:00:00

I thought for some simple tests that just run a few commands i would try using some JavaScript and run it from the command line in Windows XP.



So for a quick test I created a script



alert('Hello, World!');


Then tried to run it



D:>Cscript.exe hello.js
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

D:hello.js(1, 1) Microsoft JScript runtime error: Object expected


Google has not helped and I am sure I am missing something silly, can any of you guys shed any light on why this simple script doesn't run?


More From » windows

 Answers
12

You are calling a function called alert, but this is not part of JavaScript (it is part of DOM 0 and is provided by browsers)



Since you haven't defined it, you are trying to treat undefined as a function, which it isn't.



Qnan suggests using the Echo method instead.


[#83500] Monday, August 20, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brandt

Total Points: 43
Total Questions: 90
Total Answers: 111

Location: Aruba
Member since Fri, Jun 24, 2022
2 Years ago
brandt questions
Sun, Jul 4, 21, 00:00, 3 Years ago
Wed, Jun 30, 21, 00:00, 3 Years ago
Sat, Jan 23, 21, 00:00, 3 Years ago
Mon, Sep 21, 20, 00:00, 4 Years ago
;