Re: Script running infinitely when calling wscript.exe from code
- From: "Todd Vargo" <tlvargo@xxxxxxxxxxxxxx>
- Date: Wed, 4 Nov 2009 16:45:02 -0500
"mayayana" <mayaXXyana@xxxxxxxxx> wrote in message
news:uElVOiVXKHA.4688@xxxxxxxxxxxxxxxxxxxxxxx
If Not Right(Wscript.FullName, 12) = "\WSCRIPT.EXE" ThenWscript.ScriptFullName
CreateObject("Wscript.Shell").Run "wscript.exe " &
Wscript.Quit
End If
While we're splitting hairs...:)
I think you also need UCase there. You can
search for a file case-insensitive but string
operations are at root numeric and therefore
case-sensitive:
Dim s
s = "abcd"
If Right(s, 2) = "CD" Then
MsgBox "Match."
Else
MsgBox "No match."
End If
WScript.exe is named with all caps on my PC,
but I wouldn't want to depend on that. Microsoft
seems to be fairly willy nilly about that sort of thing.
(The other day I downloaded a VB6 service pack
full of .ocx files. The file extensions alone had at
least 3 different cap. versions: .ocx, .OCX, .Ocx )
FWIW, I checked prior to posting. Wscript.FullName always returns upper case
(on my Win98 system at least) regardless of actual host name. For my
testing, I created a copy of each host and renamed it to "Foo_Bar_Baz.exe"
and ran this.
Wscript.Echo Wscript.FullName
The full LFN was returned in all caps.
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
.
- References:
- Script running infinitely when calling wscript.exe from code
- From: Tom Tyson
- Re: Script running infinitely when calling wscript.exe from code
- From: Todd Vargo
- Re: Script running infinitely when calling wscript.exe from code
- From: Al Dunbar
- Re: Script running infinitely when calling wscript.exe from code
- From: Todd Vargo
- Re: Script running infinitely when calling wscript.exe from code
- From: mayayana
- Script running infinitely when calling wscript.exe from code
- Prev by Date: Re: VBS login Google Finance webpage
- Next by Date: Re: Script running infinitely when calling wscript.exe from code
- Previous by thread: Re: Script running infinitely when calling wscript.exe from code
- Next by thread: Re: Script running infinitely when calling wscript.exe from code
- Index(es):
Relevant Pages
|