Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- There is IT 230 Week 6 Remote Access Solution in this pack.
- Computer Science - General Computer Science
- VBScript Modular Programming Lab
- Objective
- In this lab, students will complete the following objectives.
- · Create a VBScript program using NotePad++.
- · Use procedures to modularize a VBScript program.
- · Create a library of procedures.
- · Run library procedures from a separate VBScript program.
- Element K Network Connections
- For this lab, we will only need to connect to vlab-PC1 . The computer vlab-PC1 is the computer on the left side while vlab-PC2 is on the right. If you leave the cursor on the PC icon for a few seconds, a tool-tip message will appear indicating the hostname of the PC. Open vlab-PC1 and log in as Administrator with the password password .
- Note: All captures must be text only — DO NOT capture the NotePad++ application window or the command prompt window. Use copy and paste of text only.
- Task 1: Ensure that the PC_Tests Scripts are in C:\Scripts\
- Open the Windows CLI Using the Desktop or Quick Launch Command Prompt icon. Change Directory to the C:\Scripts\ folder ( cd \Scripts) . Verify that the files PC_Tests.cmd and PC_Tests.vbs exists in this directory. If the files are absent, they can be extracted from the downloaded Doc Sharing file PC_Tests.zip .
- Task 2: Open C:\Scripts\PC_Tests.cmd in NotePad++
- Open NotePad++ and use File/Open to view the C:\Scripts\PC_Tests.cmd script file in the Editor window.
- An analysis of the PC_Tests.cmd Batch script program is shown on the next page.
- Task 2: Analyze the Batch Script File PC_Tests.cmd
- One of the drawbacks of using VBScript instead of a full-featured programming language such as C++ or Java is the fact that VBScript does not have the capability to clear the command prompt screen. This is one of the things we need to do with our menu-driven PC_Tests program each time the menu is re-displayed. Since we can’t do this in VBScript, we will do it in a Batch script file.
- Look at the PC_Tests.cmd Batch script shown on the right. The script performs the following tasks.
- 1. Clear the screen (CLS).
- 2. Display the menu .
- 3. Prompt the User and store the input into
- choice.
- 4. Run the PC_Tests.vbs program and
- send it the choice value (1..5) as an
- argument (//nologo hides the scripting
- host heading).
- 5. When the PC_Tests.vbs program exits
- and returns to the Batch script, execute
- a Pause .
- 6. After the user presses a key to end the
- pause, go to the start of the script to
- clear the screen and re-display the
- menu.
- A sample Batch script run of Option 1 is shown below.
- Task 3: Analyze the code in the PC_Tests.vbs Program
- · Open the PC_Tests.vbs program in NotePad++. Let’s review some code that can tell us many important things about the computer and the Windows Operating System. Option 1 from the menu is handled by Case “1” in the Select Case statement . The VBScript code shows how to access the values of Windows Environmental variables using the WScript.Shell object’s ExpandEnvironmentStrings( ) function. Note that the environmental variables must be delimited with the % character. Do a search for Windows Environmental Variables. They can provide a wealth of information about the computer and the operating system. A Run of this code is shown belo
- · Option
- To download more course tutorials visit - https://bitly.com/1xpyudX
- Acquiring a college education is a goal that countless individuals hope to achieve. However, the idea of selecting a school, choosing a major and charting a course for ultimate success can seem like a series of insurmountable challenges. Fortunately, the tips that follow below offer a framework for getting the entire process underway.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement