[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:48:34)
> cscript Whatever.js Why wont you work
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
Input Error: There is no script engine for file extension ".js".
[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:48:34)
>
I dreaded this error that greeted me several times this summer from the command line in Windows world.
My .js files were properly associated, so that wasn't the issue.
[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:48:34)
> assoc .js
.js=JSFile
[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:49:48)
>
And the workaround I implemented was a pain and involved tweaking the registry. That would last for days until I had to restart or fired up a new command prompt window. So the registry tweak thing wasn't sticking for some reason! Was driving me insane!!
Finally, I studied the cscript help output..
[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:49:48)
> cscript /?
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
Usage: CScript scriptname.extension [option...] [arguments...]
Options:
//B Batch mode: Suppresses script errors and prompts from displaying
//D Enable Active Debugging
//E:engine Use engine for executing script
//H:CScript Changes the default script host to CScript.exe
//H:WScript Changes the default script host to WScript.exe (default)
//I Interactive mode (default, opposite of //B)
//Job:xxxx Execute a WSF job
//Logo Display logo (default)
//Nologo Prevent logo display: No banner will be shown at execution time
//S Save current command line options for this user
//T:nn Time out in seconds: Maximum time a script is permitted to run
//X Execute script in debugger
//U Use Unicode for redirected I/O from the console
[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:50:19)
>
There it was all along...tricky little option!! //E:engine
I added this into my real script like so:
[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:51:08)
> ImportData.cmd
[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:51:13)
> cd /d C:\Users\AmiBroker\
[PHOENIX] C:\Users\Users\AmiBroker\ (Thu 09/03/2009 18:51:13)
> cscript ImportDataToAmiBroker.js //E:JavaScript C:\Users\AmiBroker\data.futurestick\AmiBroker\
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
Arguments:
Ami Database Folder = C:\Users\AmiBroker\data.futurestick
Quotes Format FileName = quiksilver.format
Symbol Info Format FileName = quiksilver.symbol-info.format
Import Data Folder = C:\Users\AmiBroker\
Voila! Works every time now in between restarts and command line windows :)
Thursday, September 3, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment