Вы находитесь на странице: 1из 6

Student Name

Class

COMP230

Date

VBScript IPO VBox Lab Report


Copy your NameAge.vbs program from NotePad++ and paste it into the space provided below:.
' VBScript: NameAge.vbs ' Written by: ' Date: ' Class: COMP230 ' Professor: name = "Your Name" ageStr = "28" WScript.StdOut.Write("Pleast Enter your Full Name.............. ") name = WScript.StdIn.ReadLine() WScript.StdOut.WriteLine() WScript.StdOut.Write("Please Enter your age ................... ") ageStr = Wscript.StdIn.ReadLine() ageStr10 = CStr( CInt(ageStr)+10 ) WScript.StdOut.WriteBlankLines(2) WScript.StdOut.WriteLine("Your Name is " & vbTab & vbTab & name) Wscript.StdOut.WriteLine("Your Age is " & vbTab & vbTab & ageStr) WScript.StdOut.Writeline(vbCrLf & "Your Age in 10 years is ...... " & _ ageStr10 & vbCrLf) WScript.StdOut.WriteLine("End of Program")

COMP230_W2_IPO_VBReport.docx

Revision Date: 1204

Capture the NameAge.vbs Run from the console window and copy it into the space provided below:
cscript NameAge.vbs Process started >>> Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. Pleast Enter your Full Name.............. Your Name Please Enter your age ................... 28 Your Name is Your Age is Your Name 28

Your Age in 10 years is ...... 38 End of Program <<< Process finished. ================ READY ================

COMP230_W2_IPO_VBReport.docx

Revision Date: 1204

Copy your PopUpWindow.vbs program from NotePad++ and paste it into the space provided below:
' VBScript: PopUpWindow.vbs ' Written by: ' Date: ' Class: COMP230 ' Professor: name = "John Doe" ageStr = "50" ageStr10 = CStr( CInt(ageStr)+10 ) WScript.Echo WScript.Echo WScript.Echo ageStr10 & WScript.Echo "Your Name is " & vbTab & vbTab & name "Your Age is " & vbTab & vbTab & ageStr vbCrLf & "Your Age in 10 years is ...... " & _ vbCrLf "End of Program"

name = "John Doe" ageStr = "50" ageStr10 = CStr( CInt(ageStr)+10 ) 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" WScript.Echo msgStr

COMP230_W2_IPO_VBReport.docx

Revision Date: 1204

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_VBReport.docx

Revision Date: 1204

Copy your CmdArgs.vbs program from NotePad++ and paste it into the space provided below:
' ' ' ' ' VBScript: CmdArgs.vbs Written by: Date: Class: COMP230 Professor:

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 name = args.item(0) ageStr = args.item(1) ageStr10 = CStr( CInt(ageStr)+10 ) 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" WScript.Echo msgStr

COMP230_W2_IPO_VBReport.docx

Revision Date: 1204

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 "Your Name" 28 Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. Your name is Your age is Your Name 28

Your Age in 10 years will be ...... 38 End of Program

COMP230_W2_IPO_VBReport.docx

Revision Date: 1204

Вам также может понравиться