Page 1 of 1 1
Topic Options
#194269 - 2009-06-15 08:06 PM vbs script called from kix errors but not from command line
Ben_H Offline
Fresh Scripter

Registered: 2007-05-15
Posts: 7
Loc: Indiana
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?
_________________________
Ben

Top
#194270 - 2009-06-15 08:17 PM Re: vbs script called from kix errors but not from command line [Re: Ben_H]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
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
_________________________
Actually I am a Rocket Scientist! \:D

Top
#194271 - 2009-06-15 08:18 PM Re: vbs script called from kix errors but not from command line [Re: Ben_H]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
It is not getting something that it expects. Look at what is on line 91 in the VBS script to see what it needs.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#194272 - 2009-06-15 08:28 PM Re: vbs script called from kix errors but not from command line [Re: Glenn Barnas]
Ben_H Offline
Fresh Scripter

Registered: 2007-05-15
Posts: 7
Loc: Indiana
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

Top
#194273 - 2009-06-15 08:29 PM Re: vbs script called from kix errors but not from command line [Re: Gargoyle]
Ben_H Offline
Fresh Scripter

Registered: 2007-05-15
Posts: 7
Loc: Indiana
Like I said the script behaves as expected and does not error when run from the command line only when called from kix.
_________________________
Ben

Top
#194275 - 2009-06-15 11:01 PM Re: vbs script called from kix errors but not from command line [Re: Ben_H]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
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.

Top
#194281 - 2009-06-16 03:32 PM Re: vbs script called from kix errors but not from command line [Re: Allen]
Ben_H Offline
Fresh Scripter

Registered: 2007-05-15
Posts: 7
Loc: Indiana
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?
_________________________
Ben

Top
#194285 - 2009-06-16 05:14 PM Re: vbs script called from kix errors but not from command line [Re: Ben_H]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 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.

Top
#194317 - 2009-06-18 09:31 PM Re: vbs script called from kix errors but not from command line [Re: Richard H.]
Ben_H Offline
Fresh Scripter

Registered: 2007-05-15
Posts: 7
Loc: Indiana
Thanks
_________________________
Ben

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.045 seconds in which 0.018 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org