Okay -- did I not provide enough information on this? It would be helpful
if someone could at least let me know if this sounds like a bad install or
something. I want the system I'm working on to be multiplatform, and I
need to be able to count on VBScript to do that. If VBScript is so
inherently unstable it is not uncommon to have problems like this, or if
there is no answer to problems like this, then it is not usable for my
purposes.
Could someone at least give me a few suggestions -- or comments, like is
this kind of problem common, does it indicate a bad install? Did I do
something wrong, or is the code okay, but there is no way to tell why it's
not working?
I'd really like to get some ideas on this, but if I don't, I'll just have to
tell my clients they need a separate computer to run my system (so far all
clients have had no issue with this -- the system I use raises their profit
margin enough to make it a worthwhile investment) and that it is not
possible to make it work on Windows. It's not that I'm trying to threaten,
but when I started this, I found quick support from the Perl and Linux
communities and my experience with VBScript and other questions is like
this -- I can ask questions and not even get an answer like, "Your code
looks okay, and I can't see anything wrong with it." I've never posed a
question on ANY Java, Perl, or Linux forum and had no answers at all. It's
very frustrating, and if there is a reason I'm not getting ANY answers on
this, I'd like to know.
Hal
Hal Vaughan wrote:
I have a script used to find and run Java on a Windows system.**It*worked
fine on original tests (on a Windows XP system).**It's*now*running*on*a
Windows 2000 (sp3) system, and it won't work -- the problem is this line:
set oCommand = WshShl.Exec(sCommand)
(it's about halfway down)**Is*there*a*problem*with*the*Exec*method*in* some
versions of VBS?**Is*the*problem*Windows*version*I'm*on,*or*is *it
something more obvious that I'm just not seeing?
The error is that the object doesn't support the Exec method.**(I've*also
substituted the string sCommand with "C:\WINNT\System32\sol.exe" just to
make a quick check, and it makes no difference (not that it should with
that error message, I just wanted to try a .exe I knew was there and
working).
Thanks for any help!
Hal
'
'Set up initial variables
'
qm = chr(34)
sqm = chr(39)
set WshShl = WScript.CreateObject("WScript.shell")
sOut = "No Java Installed"
On Error Resume Next
sVersion = WshShl.RegRead("HKLM\SOFTWARE\JavaSoft\Java Runtime
Environment\CurrentVersion")
sJava = WshShl.RegRead("HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\"
& sVersion & "\JavaHome")
On Error Goto 0
sJava = sJava + "\bin\java.exe"
sCommand = sJava + " -version"
set oCommand = WshShl.Exec(sCommand)
iCount = 10
Do While oCommand.Status = 0
WScript.Sleep*100
Loop
'WScript.Sleep 1000
25
sOut = oCommand.StdErr.ReadAll
WScript.StdOut.WriteLine("Command: ")
'WScript.StdOut.WriteLine("Command: " & sJava)
'WScript.StdOut.WriteLine(sOut)
WScript.StdOut.WriteLine(sVersion