Forum Moderators: open
validate.js myxmlfile.xml When I run this file, it opens Dreamweaver, I'm assuming that is because DW is the app associated with .js files.
I've never heard of running .js files directly from the command prompt, but It's obviously possible (since someone wrote a .bat and sent it to me). What do I need to do to make it work?
Thanks for your help ;)
//ZS
There are 2 applications that are relevant:
WScript.exe [C:\windows]
CScript.exe [C:\windows\command]
These run .js ¦ .wsf ¦ .vbs files.
CScript is more associated with the command line, but I'll go for WScript.exe.
Here's a quick demo:
1. create this JScript file
save it in C directory, (as xx.js)
...... xx.js .......alert = function(s){WScript.Echo(s)}
var arg = WScript.arguments(0)
alert(arg.toUpperCase() + " now upper case")
....................
2. open the command prompt, and type (assuming at C:\> prompt)
C:\> windows\wscript.exe xx.js "apples and bananas" then return
What we have is:
<path to script host><path to .js file><argument for .js file> I'm assuming that in your case, the .xml file path is sent as an arg to the script file.
What's missing is the path to scripting host.
PS. Try dragging & dropping the xml file onto the .js file. See what happens.