I have this as part of a overall script...

Sub ParseCommandLine()
Dim vArgs

set vArgs = WScript.Arguments

if vArgs.Count <> 2 then
DisplayUsage()
Else
host = vArgs(0)
EventID = vArgs(1)
End if
End Sub

I want to use the host variable in the strcomputer = "." line in my script
(obviously replacing the . with the variable name) I have tried "'&host&'",
&host& and every other combonation... What is the correct syntax to get the
command line variable host (or) vArgs(0) for the strcomputer = line?

Thanks
-david

Re: Using a vArg from the comand line for strComputer by McKirahan

McKirahan
Mon Nov 01 10:56:17 CST 2004

"David Doumani" <ddoumani@verizon.net> wrote in message
news:ujVPirCwEHA.4028@TK2MSFTNGP15.phx.gbl...
> I have this as part of a overall script...
>
> Sub ParseCommandLine()
> Dim vArgs
>
> set vArgs = WScript.Arguments
>
> if vArgs.Count <> 2 then
> DisplayUsage()
> Else
> host = vArgs(0)
> EventID = vArgs(1)
> End if
> End Sub
>
> I want to use the host variable in the strcomputer = "." line in my script
> (obviously replacing the . with the variable name) I have tried
"'&host&'",
> &host& and every other combonation... What is the correct syntax to get
the
> command line variable host (or) vArgs(0) for the strcomputer = line?
>
> Thanks
> -david


Show us the code where you want to assign "strcomputer".

Is "Dim host" outsaide of the Sub?

Always use "Option Explicit" to ensure variables are declared.



Re: Using a vArg from the comand line for strComputer by David

David
Mon Nov 01 13:03:27 CST 2004

It was the lack of the DIM statement at the top - thanks for the help.
"McKirahan" <News@McKirahan.com> wrote in message
news:RUthd.43018$R05.12087@attbi_s53...
> "David Doumani" <ddoumani@verizon.net> wrote in message
> news:ujVPirCwEHA.4028@TK2MSFTNGP15.phx.gbl...
>> I have this as part of a overall script...
>>
>> Sub ParseCommandLine()
>> Dim vArgs
>>
>> set vArgs = WScript.Arguments
>>
>> if vArgs.Count <> 2 then
>> DisplayUsage()
>> Else
>> host = vArgs(0)
>> EventID = vArgs(1)
>> End if
>> End Sub
>>
>> I want to use the host variable in the strcomputer = "." line in my
>> script
>> (obviously replacing the . with the variable name) I have tried
> "'&host&'",
>> &host& and every other combonation... What is the correct syntax to get
> the
>> command line variable host (or) vArgs(0) for the strcomputer = line?
>>
>> Thanks
>> -david
>
>
> Show us the code where you want to assign "strcomputer".
>
> Is "Dim host" outsaide of the Sub?
>
> Always use "Option Explicit" to ensure variables are declared.
>
>