WL5Nt‖SetAttr Statement

Contents
DTWb9‖

# LvBHq‖SetAttr Statement

XPYqB‖Sets the attribute information for a specified file.

### FVEx2‖Syntax:

    ZZJNh‖SetAttr PathName As String, Attributes As Integer

### WADQ4‖Parameters:

brMgq‖ FileName: Name of the file, including the path, that you want to test attributes of. If you do not enter a path, SetAttr searches for the file in the current directory. You can also use URL notation.

Gjcp9‖ Attributes: Bit pattern defining the attributes that you want to set or to clear:

bt8p5‖Named constant | p7CiG‖Value | R27uW‖Definition
--- | --- | ---
ATTR_NORMAL | 0 | uD89Z‖ Normal files.
ATTR_READONLY | 1 | rgTHb‖ Read-only files.
ATTR_HIDDEN | 2 | nUNiF‖ Hidden file

fEQi9‖You can set multiple attributes by combining the respective values with a logic OR statement.

### SEjHR‖Error codes:

5 Invalid procedure call

53 File not found

70 Access denied

### EFSA4‖Example:

    Sub ExampleSetGetAttr
    AEHB9‖ On Error GoTo ErrorHandler ' Define target for error handler
     If Dir("C:\test",16)="" Then MkDir "C:\test"
     If Dir("C:\test\autoexec.sav")="" Then FileCopy "c:\autoexec.bat", "c:\test\autoexec.sav"
     SetAttr "c:\test\autoexec.sav" ,0
     FileCopy "c:\autoexec.bat", "c:\test\autoexec.sav"
     SetAttr "c:\test\autoexec.sav" , ATTR_READONLY
     Print GetAttr( "c:\test\autoexec.sav" )
     End
    ErrorHandler:
     Print Error
     End
    End Sub

Please support us!