开发者

Cannot retrieve referenced URL

开发者 https://www.devze.com 2022-12-29 22:21 出处:网络
I have JavaScript inside a .wsf file and I\'m getting the error: C:\\bin\\LDLSInfo.wsf(53, 34) Windows Script Host:

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 compute开发者_JAVA百科rs. So I'm thinking I'm missing some .dll's.

Thanks for the help,

-jb


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&page=131


Based on the link Marcus Pope provided, and my own experience using the exact same VBS program with and without WSF, I can confirm that there is an undocumented size limitation which gives rise to the message "cannot retrieve URL" -- note that this message does not say "cannot find URL", but rather that the object file cannot be "retrieved" (loaded). I experienced this under Windows 2003. I did not confirm the maximum retrievable size, but the link gives it as 512 KB, which is consistent with my experience of being unable to load a 1200 KB file.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消