SetAttr İfadesi

Belirtilen dosya için öznitelik bilgisini ayarlar.

Sözdizimi:


SetAttr PathName As String, Attributes As Integer

Parametreler:

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:

İsimlendirilmiş sabit

Değer

Tanımlama

ATTR_NORMAL

0

Normal dosyalar.

ATTR_READONLY

1

Salt okunur dosyalar.

ATTR_HIDDEN

2

Gizli dosya


Mantıksal OR deyimi ile bbirden çok özelliği birebir değerleri ile bağlayarak atayabilirsiniz.

Hata kodları:

5 Geçersiz yordam çağrısı

53 Dosya bulunamadı

70 Erişim engellendi

Örnek:


Sub ExampleSetGetAttr
 On Error Goto ErrorHandler REM hata işleyici için hedef tanımlar
 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

Lütfen bizi destekleyin!