Results 1 to 3 of 3

Thread: Porting VBScript to Server 2003

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Location
    Durham, NC, US
    Posts
    218

    Question Porting VBScript to Server 2003

    I have the following test script: Test.vbs.

    VB Code:
    1. Dim oWSArgs
    2. Set oWSArgs = WScript.Arguments
    3.  
    4. WScript.StdOut.WriteLine StringMatch(oWSArgs(0), oWSArgs(1), True)
    5.  
    6. Function StringMatch(sString, sPattern, bIgnoreCase)
    7.  
    8.     Dim oRegEx
    9.     Set oRegEx = New RegExp
    10.    
    11.     oRegEx.IgnoreCase = bIgnoreCase
    12.     oRegEx.Pattern = sPattern
    13.     StringMatch = oRegEx.Test(sString)
    14.  
    15. 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:
    1. 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
    Travis, Kung Foo Journeyman

    Web Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.5 Guide and Reference
    Perl: Documentation, Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    OSS: Mozilla, MySQL (Manual)

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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 /?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Location
    Durham, NC, US
    Posts
    218

    Thumbs up Re: Porting VBScript to Server 2003

    Thanks, David. //Nologo works.

    Anyone have any ideas on the root problem?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width