DirSpec.Close();
TESTING SCRIPTS 189
The code begins by removing any existing output file. JavaScript and VBScript lack file support.
However, you have access to the Scripting.FileSystemObject object, which does provide full
file system support. You can use this object to perform a multitude of tasks with files, including creating,
deleting, and editing them. The FileSystemObject also includes functionality for working
with folders.
The next step is to retrieve the username, computer name, date, and time. In many cases, you can
simply use the ExpandEnvironmentStrings() method to obtain the information you need from
the system. Notice that the example code uses the Date object in place of obtaining the date from
the environment variables using the Shell.ExpandEnvironmentStrings(???%DATE%???) method.
When working with JavaScript, you can only access the environment variables that you can see
with the Set command. JavaScript doesn??™t support the extended functionality that??™s available at
the command line. In fact, you??™ll find that this general rule applies to both VBScript and JavaScript;
neither scripting language supports the extensions that you can access from a batch file at the command
prompt.
Pages:
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483