Professional Documents
Culture Documents
Class
Date
COMP230_W2_IPO_evKey.docx
Capture the NameAge.vbs Run from the console window and copy it into the space provided below:
C:\Scripts>cscript NameAge.vbs Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. Please Enter your Full Name .............. John Morgan Please Enter your age .................... 55
John Morgan 55
COMP230_W2_IPO_evKey.docx
Copy your PopUpWindow.vbs program from NotePad++ and paste it into the space provided below: ' VBScript: PopUpWindow.vbs ' Written by: Student Name ' Date: Today's Date ' Class: COMP230 ' Professor: Professor Name ' ============================================== 'Create name and age variables name = "John Doe" ageStr = "50" ' Calculate Age+10 and assign to ageStr10 ageStr10 = CStr( CInt(ageStr)+10 ) ' Build output as a single string msgStr msgStr = "Your name is " & vbTab & vbTab & name & _ vbCrLf & "Your age is " & vbTab & vbTab & ageStr & _ vbCrLf & vbCrLf & "Your Age in 10 years will be ...... " & _ ageStr10 & vbCrLf & vbCrLf & "End of Program" 'One Echo Statement for all output WScript.Echo msgStr
COMP230_W2_IPO_evKey.docx
Capture the PopUpWindow.vbs Run (using <Alt><PrtSc> to capture the PopUp Window on the desktop) and copy it into the space provided below:
COMP230_W2_IPO_evKey.docx
Copy your CmdArgs.vbs program from NotePad++ and paste it into the space provided below: ' VBScript: CmdArgs.vbs ' Written by: Student Name ' Date: Today's Date ' Class: COMP230 ' Professor: Professor Name ' ============================================== ' Check for Command Line Arguments Set args = WScript.Arguments If args.Count < 2 then WScript.Echo "You must enter the name and age as Command Line Arguments!!" WScript.Sleep(5000) WScript.Quit end If ' Assign name and age variables to Cmd Line Args name = args.item(0) ageStr = args.item(1) ' Calculate Age+10 and assign to ageStr10 ageStr10 = CStr( CInt(ageStr)+10 ) ' Build output as a single string msgStr msgStr = "Your name is " & vbTab & vbTab & name & _ vbCrLf & "Your age is " & vbTab & vbTab & ageStr & _ vbCrLf & vbCrLf & "Your Age in 10 years will be ...... " & _ ageStr10 & vbCrLf & vbCrLf & "End of Program" 'One Echo Statement for all output WScript.Echo msgStr
COMP230_W2_IPO_evKey.docx
Capture the two CmdArgs.vbs console Runs (one without arguments and one using your name and age as arguments) and copy the runs into the space provided below:
C:\Scripts>cscript CmdArgs.vbs Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. You must enter the name and age as Command Line Arguments!!
C:\Scripts>cscript CmdArgs.vbs "Jane Doe" 35 Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. Your name is Your age is Jane Doe 35
COMP230_W2_IPO_evKey.docx