The %DATE% environment variable requires a little more manipulation than %TIME%. In this case,
the string contains the day of the week, so you must extract that information from the string as well.
Consequently, the month always appears at position 4, rather than 0.
Now that the batch file has built a unique filename based on the machine name, username, date,
and time, it adds a file extension of .TXT to it. The result appears in place of the standard filename
in the FOR command for this example. Notice that you must enclose the filename with quotes
because it could contain a space.
Using a Centralized Data Store
One problem that none of the examples in the book have addressed so far is the use of a centralized
data store. Overcoming this problem with scripts is relatively easy because you have access to standard
database objects. With the proper code, you can simply send the data from a client machine
to a server and never have to worry about it again except for analysis purposes. However, batch
files don??™t support database objects and the individual machine records discussed so far in the book
are ill suited for import into a database.
Pages:
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412