脚本增强与运行指南
1. 为脚本添加文档
在完成第一个脚本后,我们可以对其进行修改以增强功能。首先要做的是为脚本添加文档,这样六个月后再看脚本时,就能清楚其用途。
添加文档的方法很简单,只需在脚本中输入信息,但要防止脚本出错,需表明正在添加文本。最有效的方式是在每条注释前加上单引号(’),后跟解释性文本。
以下是添加了文档的脚本示例:
'This script displays various Computer Names by reading the registry
Option Explicit 'forces the scripter to declare variables
On Error Resume Next 'tells VBScript to go to the next line
'instead of exiting when an error occurs
'Dim is used to declare variable names that are used in the script
Dim objShell
Dim regActiveComputerName, regComputerName, regHostname
Dim ActiveComputerName, ComputerName, Hostname
'When you use a variable name and then an equal sign (=)
'you're saying the variable contains the information on the r
超级会员免费看
订阅专栏 解锁全文
445

被折叠的 条评论
为什么被折叠?



