Tài liệu Writing a Script in Windows 2000 doc

3 350 0
Tài liệu Writing a Script in Windows 2000 doc

Đang tải... (xem toàn văn)

Thông tin tài liệu

1 - 3 IT Essentials II v2.0 - Lab 8.5.6 Copyright  2002, Cisco Systems, Inc. Lab 8.5.6: Writing a Script in Windows 2000 Estimated Time: 30 Minutes Objective The objective of this lab is to learn how to write a script in Windows 2000. Equipment The following equipment is required for this exercise: • A computer running Windows 2000 Professional Scenario The system administrator needs to create a script in the startup folder that will display on the users desktops when they log on to their systems. To experiment with writing scripts for that, practice with a sample script that will be created in this lab. Procedures In this lab, the student will create and execute a Visual Basic Script and place it the start menu. Step 1: Writing the Script 1. Open up Notepad. Go to Start > Programs > Accessories > Notepad. 2. Type this text into Notepad: Dim Greeting Dim UserName UserName = InputBox ("Please enter your name:") UserName = Trim (UserName) 2 - 3 IT Essentials II v2.0 - Lab 8.5.6 Copyright  2002, Cisco Systems, Inc. If UserName = "" Then Greeting = "Why won't you tell me your name? That's not very nice." ElseIf UserName = "go away" Then Greeting = "That's not very nice." ElseIf Username = "who's asking?" Then Greeting = "I asked you first." Else Greeting = "Hello, " & UserName & ", it's a pleasure to meet you." If UserName = "Steve" Then Greeting = Greeting & " I like the name Steve." End IF End IF MsgBox Greeting 3. Save the document as “Greeting.vbs” Note: If the student needs to edit changes after saving, have them change the extension to .txt. To change the file back to a .vbs scripts go to the following folder: C:\WINNT\system32 In this folder associate the Greeting.vbs file with the wscript file. Step 2: Executing the Script 1. Navigate to the folder where the file was saved and double-click on it. 2. Do not type anything in the box and click OK. Notice what message is displayed and how it corresponds to the entry in the text of the script. 3. Click OK. 4. Double-click the script again and this time type go away in the box. Notice what message is displayed and how it corresponds to the entry in the text of the script. 3 - 3 IT Essentials II v2.0 - Lab 8.5.6 Copyright  2002, Cisco Systems, Inc. 5. Click OK. 6. Double-click the script again and this time type who’s asking in the box. Notice what message is displayed and how it corresponds to the entry in the text of the script. 7. Click OK. 8. Double-click the script again and this time type Alice in the box. Notice what message is displayed and how it corresponds to the entry in the text of the script. 9. Click OK. 10. Double-click the script again and this time type Steve in the box. Notice what message is displayed and how it corresponds to the entry in the text of the script. Step 3: Executing the script when the system starts 1. Navigate to the Startup folder. Go to C:/Document and Settings/All Users/Start Menu/Programs/Startup. Drag the script file that was created in Step 1 and place it into the folder. 2. Restart the computer and the script should execute automatically when the system reboots. Troubleshooting Troubleshooting a Visual Basic Script or can be difficult since the text has to be 100 percent accurate for the script to execute properly. Review the script before it is saved and executed to make sure that is written correctly. Reflection Scripts can serve a variety of functions and can be very helpful to a system administrator. The script that was written in this lab was fairly simple script compared to how complex a Visual Basic script can be. 1. What are some other uses for scripts? 2. Where might they be useful and where might they cause harm? . to a system administrator. The script that was written in this lab was fairly simple script compared to how complex a Visual Basic script can be. 1. What. writing scripts for that, practice with a sample script that will be created in this lab. Procedures In this lab, the student will create and execute a

Ngày đăng: 11/12/2013, 15:15

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan