Ben_H
(Fresh Scripter)
2009-06-15 08:06 PM
vbs script called from kix errors but not from command line

platform: Windows 2008 64 bit, kix32 version: 4.60

I am calling an application supplied vbs script from my kix script:

run "%COMSPEC% /c start \\hawksrv1\watertight\SetupWatertightClient.vbs"

I get the following error:
Windows Script Host
script: \\hawksrv1\watertight\setupwatertightclient.vbs
line: 91
char: 3
error: Path not found
code: 800a004c
Source: Microsoft VBScript Runtime error

However if I type in:
%COMSPEC% /c start \\hawksrv1\watertight\SetupWatertightClient.vbs
from the command line no problems, the script runs just fine. So it is hard to blame it on the script.

I've tried SHELL instead of RUN, I've tried a layer of indirection by calling a .cmd file that calls the vbs, I've tried getting rid of the "start" portion, but they all blow up!

Any Ideas?


Glenn BarnasAdministrator
(KiX Supporter)
2009-06-15 08:17 PM
Re: vbs script called from kix errors but not from command line

Just for giggles.. map a drive to \\hawksrv1\watertight, CD to that drive, and then run the VBscript with
 Code:
Shell '%COMSPEC% /c cscript.exe .\setupwatertightclient.vbs'


What happens then?

If that works, try the UNC path, but reference the CSCRIPT.EXE. The issue could be the child environment settings at the time you run the script.

Glenn


Gargoyle
(MM club member)
2009-06-15 08:18 PM
Re: vbs script called from kix errors but not from command line

It is not getting something that it expects. Look at what is on line 91 in the VBS script to see what it needs.

Ben_H
(Fresh Scripter)
2009-06-15 08:28 PM
Re: vbs script called from kix errors but not from command line

results with drive letter and cscript are the same:

 Quote:
C:\Users\Administrator>w:

W:\>cd \

W:\>cscript.exe .\SetupWatertightClient.vbs
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

W:\SetupWatertightClient.vbs(91, 3) Microsoft VBScript runtime error: Path not found


And once again no problems when run directly from the command line only when run from kix.


Ben_H
(Fresh Scripter)
2009-06-15 08:29 PM
Re: vbs script called from kix errors but not from command line

Like I said the script behaves as expected and does not error when run from the command line only when called from kix.

AllenAdministrator
(KiX Supporter)
2009-06-15 11:01 PM
Re: vbs script called from kix errors but not from command line

Line 91 in your vbs ... what is it? The error says: 91, 3) Microsoft VBScript runtime error: Path not found

Since its not working in kix, and you are trying to make it, then this line (or lines around it) seems to be relevant to this discussion.


Ben_H
(Fresh Scripter)
2009-06-16 03:32 PM
Re: vbs script called from kix errors but not from command line

OK, I actually put some debugging code in the vbs script:

msgbox(oShell.ExpandEnvironmentStrings("%programfiles%"))

Does anybody know why the above returns "c:\program files" when run from the command line, but "c:\program files(x86)" when run from kix?


Richard H.Administrator
(KiX Supporter)
2009-06-16 05:14 PM
Re: vbs script called from kix errors but not from command line

 Originally Posted By: Ben_H
Does anybody know why the above returns "c:\program files" when run from the command line, but "c:\program files(x86)" when run from kix?


Yup, look up SetOption(), specifically the file redirection option:
 Quote:
Wow64FileRedirection ON,OFF Enables/disables file redirection on 64-bit editions of Windows. See this MSDN article for details of this feature.
This option has no effect on 32-bit editions of Windows.


Ben_H
(Fresh Scripter)
2009-06-18 09:31 PM
Re: vbs script called from kix errors but not from command line

Thanks