Módulo
Contido
Índice 🔎︎

# SetAttr Statement

Configura a información de atributo do ficheiro especificado.

## Sintaxe:

    SetAttr NomeFicheiro As String, Atributo As Integer

## Parámetros:

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.

Attribute: Bit pattern defining the attributes that you want to set or to clear:

Valor da cor

Named constant | Valor | Definición
ATTR_NORMAL | 0 | Ficheiros normais.
ATTR_READONLY | 1 | Read-only files.
ATTR_HIDDEN | 2 | Hidden file

Para configurar varios atributos, combine os valores respectivos cunha instrución OR lóxica.

## Códigos de erro

5 Chamada de procedemento incorrecta

53 Ficheiro non atopado

70 Acceso denegado

## Exemplo:

    Sub ExampleSetGetAttr

     On Error Goto ErrorHandler REM 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