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?
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
undefinedas a function, which it isn’t.Qnan suggests using the Echo method instead.