Utilities.FileSetAttr Method

Applies to TestComplete 15.10, last modified on December 01, 2021
This method is obsolete. See the Remarks section below.


Use the Utilities.FileSetAttr method to set the attributes of the specified file. To address an attribute, use constants listed in the description of the FileGetAttr method. To combine several attributes, use the or operator. For instance, the following code makes the c:\MyFile.txt file read-only and hidden:

JavaScript, JScript

Utilities.FileSetAttr("C:\\MyFile.txt", Utilities.faReadOnly | Utilities.faHidden);


Utilities.FileSetAttr("C:\\MyFile.txt", Utilities.faReadOnly | Utilities.faHidden)


Utilities.FileSetAttr "C:\MyFile.txt", Utilities.faReadOnly Or Utilities.faHidden


Utilities.FileSetAttr('C:\MyFile.txt', Utilities.faReadOnly or Utilities.faHidden);

C++Script, C#Script

Utilities["FileSetAttr"]("C:\\MyFile.txt", Utilities["faReadOnly"] | Utilities["faHidden"]);


Utilities.FileSetAttr(FileName, Attr)

FileName [in]    Required    String    
Attr [in]    Required    Integer    
Result Integer

Applies To

The method is applied to the following object:


The method has the following parameters:


Specifies the file whose attributes you want to change.


Specifies the attributes to be set to the specified file.

Result Value

If the attributes have been set successfully, the function returns 0. Otherwise, it returns a Windows error code.


This method is obsolete. It is supported for backward compatibility only. To set file’s attributes, use the aqFile.SetFileAttributes or aqFileInfo.SetFileAttributes method.

See Also

SetFileAttributes Method
SetFileAttributes Method
GetFileAttributes Method
Attributes Property
FindFiles Method
TSearchRec Object

Highlight search results