Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
In addition to enumerating file attributes, the FileSystemObject provides a way to configure the following attributes:
To configure a file attribute, the script should use the following procedure:
For example, if you want to make a file read-only, check to see whether the file has already been marked read-only.
The script in Listing 4.29 uses the AND operator to check whether the switch with the value 1 (read-only) has been set on the file C:\FSO\TestScript.vbs. If the file is not read-only, the script uses the XOR operator to turn the switch on and mark the file as read-only.
Listing 4.29 Configuring File Attributes
|
|
You can also simultaneously remove the ReadOnly, Hidden, System, and Archive attributes by using the following code statement:
objFile.Attributes = objFile.Attributes AND 0
Send us your feedback | « Previous | Next » |