logo

Previous Thread:   Lock computer

6/20/2005 8:45:25 AM    How to pass parameters to vbscript
Hi,  
  
Does anybody know how to pass the parameter to vbscript file. For example  
  
CScript A.vbs <Paramater>  
  
Where can I find the sample vbs code.  
  
Thanks in advance

6/20/2005 10:55:55 AM    Re: How to pass parameters to vbscript
Sheila wrote:  
  
Hi,  
  
The VBScript (A.vbs) can access the parameters using the Arguments  
  
collection of the Wscript object. For example, in A.vbs:  
  
' Make sure there are at least 2 arguments.  
  
If (Wscript.Arguments.Count < 2) Then  
  
Wscript.Echo "Required Parameter missing"  
  
Wscript.Quit  
  
End If  
  
' Retrieve the first argument (index 0).  
  
strName = Wscript.Arguments(0)  
  
' Retrieve the second argument.  
  
strServer = Wscript.Arguments(1)  
  
--  
  
Richard  
  
Microsoft MVP Scripting and ADSI  
  
Hilltop Lab web site - http://www.rlmueller.net  
  
--