SetAttr sakinys

Nustato nurodyto failo atributo informaciją.

Sintaksė:


SetAttr PathName As String, Attributes As Integer

Parametrai:

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.

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

Įvardinta konstanta

Reikšmė

Aprašas

ATTR_NORMAL

0

Įprastas failas.

ATTR_READONLY

1

Tik skaitymui failai.

ATTR_HIDDEN

2

Paslėptas failas


Galite nustatyti kelis atributus derindami atitinkamas reikšmes ir naudodami loginį ARBA sakinį.

Klaidos kodai:

5 Neteisingas procedūros iškvietimas

53 failas nerastas

70 Prieiga nesuteikta

Pavyzdys:


Sub ExampleSetGetAttr
 On Error GoTo ErrorHandler 'Apibrėžkite klaidų tvarkytuvo tikslą
 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

Paremkite mus!