Can SilkTest set the READ-ONLY attribute on a Windows file?

Can SilkTest set the READ-ONLY attribute on a Windows file?

The best way to perform a READ-ONLY attribute change on a file in the windows file system is to use the "SYS_EXECUTE" and the windows "attrib" command. The SYS_EXECUTE function executes a specified command which it takes as a STRING parameter.

Example of use:

SYS_EXECUTE ("attrib +R c:\private\private.txt")

Would execute the command to make the "private.txt" file in the private directory read-only.

SYS_EXECUTE ("attrib -R +H c:\private\private.txt")

Would execute a command that will clear the read-only attribute and set the hidden attribute.

NOTE: SYS_EXECUTE is not available under the Windows 95 Operating System.


C:\>attrib /?
Displays or changes file attributes.

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [[drive:] [path] filename]

+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
/S Processes matching files in the current directory
and all subdirectories.


Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:31
Updated by:
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.