Named Arguments

Tech-Archive recommends: Speed Up your PC by fixing your registry



I have a new question about named arguments. I'm trying to learn this myself
from this book I have and am doing all the labs it has. I did get a little
confused on this though.

The script must support the following two Named Arguments:
/FirstName
/LastName
If the /FirstName named argument is present at the command line, do not
prompt the user for their first name. Use the first name entered as part of
the /FirstName argument.
If the /LastName named argument is present at the command line, do not
prompt the user for their last name. Use the last name entered as part of the
/LastName argument.

In my last question I had my old script reworked and made into this. Which
is by far better than what I had. Any help is very much appreciated.

Const cFOL = "C:\"
Const cTXT = "TextFile.txt"
'*
Dim strFNM
Dim strLNM
Dim strMSG
Dim strTXT
Dim strVBS
strVBS = WScript.ScriptName
'*
Dim objCTF
Dim objFSO
'*
strFNM = InputBox("What is your first name?",strVBS)
If strFNM = "" Then WScript.Quit
strLNM = InputBox("What is your last name?",strVBS)
If strLNM = "" Then WScript.Quit
'*
strTXT = cFOL & Left(strFNM,1) & strLNM & cTXT
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strTXT) Then
strMSG = strTXT & " exists!"
Else
Set objCTF = objFSO.CreateTextFile(strTXT,True)
Set objCTF = Nothing
strMSG = strTXT & " created!"
End If
'*
Set objFSO = Nothing
'*
MsgBox strMSG,vbInformation,strVBS
.



Relevant Pages

  • Re: Named Arguments
    ... Dim strFNM ... Dim strLNM ... Set objFSO = CreateObject ...
    (microsoft.public.scripting.vbscript)
  • Re: IP Range Scanner version 3
    ... Dim objFSO, objTextFile, objWMIService, colItems, objNet, objItem, i, ii, colIESettings ... Set objFSO = CreateObject ... Set colUserName = objWMIService.ExecQuery ... ' Though there are other ways to ping a computer, Win2K, ...
    (microsoft.public.scripting.vbscript)
  • Re: Scheduled task
    ... Dim oSqlConn, objPrintJob, intTotalPages, strComputer, objWMIService ... Set colPrintJobs = Nothing ... For Each objPrintJob In colPrintJobs strTextBody = strTextBody & TabData ... Set objFSO = CreateObject ...
    (microsoft.public.scripting.vbscript)
  • Re: how to avoid duplicates WHILE writing...
    ... Set objRE = New RegExp ... Dim objFSO ... Set objFSO = CreateObject ... ' Add this new email address to dictionary object. ...
    (microsoft.public.scripting.vbscript)
  • Re: how to avoid duplicates WHILE writing...
    ... Set objRE = New RegExp ... Dim objFSO ... Set objFSO = CreateObject ... ' Add this new email address to dictionary object. ...
    (microsoft.public.scripting.vbscript)