Named Arguments
- From: Det <Det@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 10 Feb 2008 22:10:01 -0800
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
.
- Follow-Ups:
- Re: Named Arguments
- From: McKirahan
- Re: Named Arguments
- From: James Whitlow
- Re: Named Arguments
- Prev by Date: Re: Script to change passwords for multiple users to logon name
- Next by Date: Re: Named Arguments
- Previous by thread: User input - Scripting help
- Next by thread: Re: Named Arguments
- Index(es):
Relevant Pages
|