| Introduction |
|
xix | |
| Who This Book Is For |
|
xix | |
| What You Need |
|
xx | |
| Resources |
|
xx | |
|
Windows Script Host Fundamentals |
|
|
1 | (10) |
|
|
|
1 | (2) |
|
|
|
2 | (1) |
|
|
|
2 | (1) |
|
|
|
3 | (1) |
|
|
|
3 | (2) |
|
|
|
3 | (1) |
|
|
|
4 | (1) |
|
|
|
5 | (4) |
|
|
|
6 | (3) |
|
|
|
9 | (1) |
|
|
|
10 | (1) |
|
|
|
10 | (1) |
|
|
|
11 | (45) |
|
|
|
11 | |
|
|
|
12 | (1) |
|
|
|
13 | (4) |
|
|
|
S14 | |
|
|
|
17 | (1) |
|
|
|
17 | (1) |
|
|
|
18 | (1) |
|
|
|
19 | (3) |
|
|
|
22 | (8) |
|
Obtaining Host Information |
|
|
24 | (1) |
|
|
|
25 | (1) |
|
|
|
26 | (1) |
|
|
|
26 | (1) |
|
|
|
27 | (3) |
|
|
|
30 | (19) |
|
The WshEnvironment Object |
|
|
31 | (1) |
|
The WshSpecialFolders Object |
|
|
32 | (3) |
|
|
|
35 | (4) |
|
Displaying Popup Messages |
|
|
39 | (3) |
|
Working with the Registry |
|
|
42 | (4) |
|
|
|
46 | (3) |
|
|
|
49 | (6) |
|
Obtaining User Information |
|
|
49 | (2) |
|
|
|
51 | (2) |
|
|
|
53 | (2) |
|
|
|
55 | (1) |
|
Creating, Running, and Scheduling Scripts |
|
|
56 | (9) |
|
|
|
56 | (1) |
|
|
|
57 | (1) |
|
|
|
58 | (6) |
|
|
|
59 | (1) |
|
|
|
60 | (4) |
|
|
|
64 | (1) |
|
Working with Script Arguments, .WSH Files, and Web Scripting |
|
|
65 | (18) |
|
|
|
65 | (3) |
|
|
|
68 | (2) |
|
|
|
70 | (1) |
|
|
|
71 | (1) |
|
Testing and Debugging Your Script |
|
|
s72 | |
|
|
|
72 | (4) |
|
|
|
72 | (2) |
|
|
|
74 | (1) |
|
|
|
75 | (1) |
|
|
|
76 | (6) |
|
|
|
76 | (1) |
|
|
|
77 | (5) |
|
|
|
82 | (1) |
|
VBScript: Syntax, Data Storage, and Operators |
|
|
83 | (17) |
|
|
|
83 | (1) |
|
Comparison with Visual Basic |
|
|
84 | (1) |
|
|
|
84 | (1) |
|
|
|
85 | (1) |
|
|
|
85 | (4) |
|
|
|
86 | (3) |
|
|
|
89 | (1) |
|
|
|
89 | (1) |
|
|
|
90 | (4) |
|
|
|
90 | (2) |
|
|
|
92 | (2) |
|
|
|
94 | (1) |
|
|
|
94 | (4) |
|
|
|
94 | (1) |
|
|
|
95 | (1) |
|
|
|
95 | (1) |
|
|
|
96 | (1) |
|
|
|
97 | (1) |
|
Operator Precedence and Parentheses |
|
|
98 | (1) |
|
|
|
99 | (1) |
|
VBScript: Program Control and Procedures |
|
|
100 | (15) |
|
|
|
100 | (4) |
|
|
|
101 | (1) |
|
|
|
102 | (2) |
|
|
|
104 | (5) |
|
|
|
104 | (1) |
|
|
|
105 | (1) |
|
|
|
106 | (2) |
|
|
|
108 | (1) |
|
|
|
108 | (1) |
|
|
|
109 | (5) |
|
|
|
109 | (1) |
|
|
|
110 | (1) |
|
Passing Arguments to Procedures |
|
|
110 | (2) |
|
|
|
112 | (1) |
|
|
|
113 | (1) |
|
|
|
114 | (1) |
|
VBScript: Working with Text, Numbers, Dates, and Times |
|
|
115 | (20) |
|
|
|
115 | (12) |
|
|
|
116 | (1) |
|
|
|
116 | (1) |
|
|
|
117 | (2) |
|
|
|
119 | (1) |
|
|
|
119 | (1) |
|
|
|
119 | (1) |
|
|
|
120 | (1) |
|
|
|
120 | (1) |
|
|
|
121 | (1) |
|
|
|
121 | (1) |
|
|
|
121 | (1) |
|
|
|
121 | (5) |
|
|
|
126 | (1) |
|
|
|
126 | (1) |
|
|
|
126 | (1) |
|
|
|
126 | (1) |
|
|
|
126 | (1) |
|
|
|
127 | (1) |
|
|
|
127 | (1) |
|
|
|
127 | (1) |
|
|
|
127 | (1) |
|
|
|
128 | (6) |
|
Date and Time Representation |
|
|
129 | (1) |
|
Getting the Current Date and Time |
|
|
129 | (1) |
|
|
|
129 | (1) |
|
Adding and Subtracting Dates and Times |
|
|
130 | (1) |
|
Getting Date and Time Information |
|
|
131 | (2) |
|
Formatting Dates and Times |
|
|
133 | (1) |
|
|
|
134 | (1) |
|
VBScript: User Interaction, Error Handling, And Miscellaneous Topics |
|
|
135 | (8) |
|
Interacting with the User |
|
|
135 | (3) |
|
|
|
135 | (2) |
|
|
|
137 | (1) |
|
|
|
138 | (2) |
|
|
|
140 | (2) |
|
|
|
141 | (1) |
|
Execute and ExecuteGlobal |
|
|
141 | (1) |
|
|
|
142 | (1) |
|
JScript: Basic Syntax, Data Storage, and Operators |
|
|
143 | (14) |
|
|
|
143 | (2) |
|
|
|
144 | (1) |
|
|
|
144 | (1) |
|
|
|
145 | (1) |
|
|
|
145 | (6) |
|
|
|
145 | (2) |
|
|
|
147 | (1) |
|
|
|
148 | (1) |
|
|
|
149 | (1) |
|
|
|
150 | (1) |
|
|
|
151 | (5) |
|
|
|
151 | (1) |
|
|
|
152 | (1) |
|
The Increment and Decrement Operators |
|
|
152 | (1) |
|
|
|
153 | (1) |
|
|
|
154 | (1) |
|
|
|
155 | (1) |
|
|
|
155 | (1) |
|
Operator Precedence and Parentheses |
|
|
156 | (1) |
|
|
|
156 | (1) |
|
JScript: Conditional Statements, Loops, and Functions |
|
|
157 | (12) |
|
|
|
157 | (4) |
|
|
|
157 | (3) |
|
|
|
160 | (1) |
|
|
|
161 | (3) |
|
|
|
161 | (1) |
|
|
|
162 | (1) |
|
|
|
163 | (1) |
|
|
|
163 | (1) |
|
|
|
164 | (1) |
|
|
|
164 | (4) |
|
|
|
165 | (1) |
|
|
|
166 | (1) |
|
|
|
167 | (1) |
|
|
|
168 | (1) |
|
JScript: Strings, Numbers, Math, Dates, and Times |
|
|
169 | (12) |
|
|
|
169 | (5) |
|
|
|
172 | (1) |
|
Working with Regular Expressions |
|
|
172 | (2) |
|
|
|
174 | (2) |
|
|
|
176 | (1) |
|
|
|
176 | (4) |
|
|
|
180 | (1) |
|
JScript: Built-in Objects, User Interaction, and Error Handling |
|
|
181 | (11) |
|
|
|
181 | (5) |
|
|
|
182 | (1) |
|
|
|
182 | (1) |
|
|
|
183 | (1) |
|
|
|
184 | (2) |
|
|
|
186 | (2) |
|
|
|
188 | (3) |
|
|
|
188 | (1) |
|
|
|
188 | (2) |
|
|
|
190 | (1) |
|
|
|
191 | (1) |
|
|
|
192 | (8) |
|
|
|
192 | (1) |
|
|
|
193 | (4) |
|
|
|
193 | (1) |
|
The <job> and <package> Tags |
|
|
194 | (1) |
|
|
|
195 | (1) |
|
|
|
195 | (1) |
|
|
|
196 | (1) |
|
|
|
197 | (1) |
|
|
|
198 | (1) |
|
|
|
199 | (1) |
|
File Access and Management |
|
|
200 | (24) |
|
The Scripting Run-time Library |
|
|
200 | (2) |
|
|
|
202 | (16) |
|
|
|
202 | (2) |
|
Copying and Moving Folders |
|
|
204 | (1) |
|
|
|
205 | (1) |
|
Deleting Files and Folders |
|
|
205 | (1) |
|
Seeing if a Drive, Folder, or File Exists |
|
|
205 | (1) |
|
Obtaining Object References |
|
|
206 | (1) |
|
Working with the Drives Collection and Drive Object |
|
|
206 | (3) |
|
Working with the Folders Collection and Folder Object |
|
|
209 | (4) |
|
Working with the Files Collection and File Object |
|
|
213 | (4) |
|
Other FileSystemObject Methods |
|
|
217 | (1) |
|
|
|
218 | (5) |
|
|
|
218 | (3) |
|
A TextStream Demonstration |
|
|
221 | (2) |
|
|
|
223 | (1) |
|
Creating Windows Script Components |
|
|
224 | (12) |
|
|
|
224 | (8) |
|
|
|
225 | (1) |
|
Defining Class Properties |
|
|
225 | (1) |
|
|
|
226 | (2) |
|
Defining Private Class Information |
|
|
228 | (1) |
|
Procedural Class Properties |
|
|
228 | (3) |
|
Defining a Default Class Property |
|
|
231 | (1) |
|
Using a Class in Multiple Scripts |
|
|
232 | (1) |
|
|
|
233 | (2) |
|
|
|
235 | (1) |
|
Database Access with Scripting |
|
|
236 | (23) |
|
|
|
236 | (3) |
|
|
|
239 | (1) |
|
|
|
240 | (1) |
|
|
|
241 | (6) |
|
Creating a Connection String |
|
|
243 | (2) |
|
|
|
245 | (2) |
|
|
|
247 | (4) |
|
|
|
251 | (7) |
|
|
|
251 | (1) |
|
Moving through a Recordset |
|
|
252 | (3) |
|
|
|
255 | (3) |
|
|
|
258 | (1) |
|
Scripting Microsoft Office Components |
|
|
259 | (27) |
|
|
|
259 | (2) |
|
|
|
261 | (10) |
|
|
|
261 | (2) |
|
Manipulating Document Content |
|
|
263 | (7) |
|
Other Document Properties and Methods |
|
|
270 | (1) |
|
|
|
271 | (14) |
|
|
|
272 | (2) |
|
|
|
274 | (11) |
|
Validating Object References |
|
|
285 | (1) |
|
|
|
285 | (1) |
|
|
|
286 | (21) |
|
|
|
286 | (2) |
|
|
|
288 | (1) |
|
|
|
289 | (5) |
|
Sending a Message with CDO |
|
|
289 | (3) |
|
|
|
292 | (2) |
|
Scripting Microsoft Outlook |
|
|
294 | (12) |
|
|
|
295 | (1) |
|
Manipulating Folders and Items |
|
|
295 | (2) |
|
Working with Mail Messages |
|
|
297 | (9) |
|
|
|
306 | (1) |
|
Using WSH For Administrative Tasks |
|
|
307 | (12) |
|
|
|
s307 | |
|
|
|
310 | |
|
|
|
s312 | |
|
|
|
315 | (3) |
|
|
|
318 | (1) |
|
A Script Programmer's Library |
|
|
319 | (13) |
|
Installing Files from a CD |
|
|
319 | (5) |
|
Obtaining Information about a Database |
|
|
324 | (5) |
|
|
|
329 | (3) |
| Appendix A VBScript Constants |
|
332 | (4) |
|
|
|
S332 | |
|
|
|
332 | (1) |
|
|
|
333 | (1) |
|
Date and Time Format Constants |
|
|
333 | (1) |
|
|
|
334 | (1) |
|
|
|
334 | (1) |
|
|
|
335 | (1) |
| Appendix B VBScript Keywords |
|
336 | (2) |
| Appendix C ASCII Character Codes |
|
338 | (3) |
| Appendix D VBScript Error Codes |
|
341 | (2) |
| Appendix E JScript Reserved Words |
|
343 | (2) |
|
|
|
343 | (1) |
|
|
|
343 | (1) |
|
|
|
344 | (1) |
| Appendix F JScript Error Codes |
|
345 | (2) |
| Appendix G WSH Resources on the Internet |
|
347 | (2) |
| Index |
|
349 | |