Porting VBScript to Server 2003
I have the following test script: Test.vbs.
VB Code:
Dim oWSArgs
Set oWSArgs = WScript.Arguments
WScript.StdOut.WriteLine StringMatch(oWSArgs(0), oWSArgs(1), True)
Function StringMatch(sString, sPattern, bIgnoreCase)
Dim oRegEx
Set oRegEx = New RegExp
oRegEx.IgnoreCase = bIgnoreCase
oRegEx.Pattern = sPattern
StringMatch = oRegEx.Test(sString)
End Function
It works on this Windows XP Professional machine. But I am getting a subscript out of range error on the Windows Server 2003 machine to which I am trying to port it on the output line:
VB Code:
WScript.StdOut.WriteLine StringMatch(oWSArgs(0), oWSArgs(1), True)
I'm sure the answer is obvious, but I'm not finding it.
Also, is it possible to avoid the title and copyright lines in the output?
Code:
C:\foo>Test.vbs "foo bar blah", "ar"
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
True
Re: Porting VBScript to Server 2003
WSCRIPT has the /NOLOGO flag, which goes after the filename, and before the arguments. To find other flags, use WSCRIPT /?
Re: Porting VBScript to Server 2003
Thanks, David. //Nologo works.
Anyone have any ideas on the root problem?