views:

64

answers:

3

I have JavaScript inside a .wsf file and I'm getting the error:

C:\bin\LDLSInfo.wsf(53, 34) Windows Script Host: 
Cannot retrieve referenced URL: S:\tools\JScript\lib\StandardWSH.js

At line 53, it says

<script language="JScript" src="S:\tools\JScript\lib\StandardWSH.js"/>

I know that LDLSInfo.wsf (the main script) and StandardWSH.js (the script to load) both work fine, because I've ran them from a different machine.

It works fine on one machine and not on the other, both are Windows 7 x64 computers. So I'm thinking I'm missing some .dll's.

Thanks for the help,

-jb

A: 

You may need to check whatever process is trying to run the script has permissions to the file referenced. Sometimes tasks are scheduled to run as accounts that dont have the permissions to read the script file, etc. It should be fine if you are just double-clicking the wsf's interactively on the machine and your account has permissions to open the file in notepad. As Pekka noted, if the script was scheduled as a task, it will run in a non-interactive process where S:\ may not be mapped. Copying to a local path is recommended for scripts that run as scheduled tasks.

Additionally, ensure the cscript.exe is the default script processor, not wscript.exe via this command:

cscript.exe //H:CScript
David
A: 

So apparently, this only occurred when I ran the .wsf in Admin mode in the command prompt.

Pekka, the S: drive is the same for both machines.

abatishchev, I didn't know that, and I fixed the script.language to "javascript".

David, cscript is the defualt processor.

When I run the script when not in Admin mode, it loads the file just fine. Of course, now I have another error to figure out, but that's another question entirely. Thanks for the input.

-jb

jb
A: 

Out of curiosity do you know the file size of your referenced file? I just ran into this problem myself and have managed to determine that if my file has a size of 524288 bytes then it works, but at 524289 bytes it fails to load.

Now, 524288 is 2^19th or 512kb so at least it's numerically significant. And running the script in a non admin account didn't work for me, so I imagine the actual error is a catch-all for more than one type of problem.

I realize that you've probably moved on from this problem and may not have that information, but for other's searching for the problem this may help them. Also, I have managed to solve my file size limit problem with a loader script that uses fso to open and eval the file that is too large.

Looks like at least one other person had the same problem as me: http://www.tek-tips.com/viewthread.cfm?qid=1345627&amp;page=131

Marcus Pope