SetAttr Statement

рд░рдирдЯрд╛рдЗрдо рдлрд╛рдЗрд▓рдХрд╛ рд▓рд╛рдЧрд┐ рд╡рд┐рд╢реЗрд╖рддрд╛ рд╕реВрдЪрдирд╛рд╣рд░реВ рд╕реЗрдЯ рдЧрд░реНрджрдЫ ред

Syntax:


SetAttr PathName As String, Attributes As Integer

Parameters:

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:

Named constant

Value

Definition

ATTR_NORMAL

0

Normal files.

ATTR_READONLY

1

Read-only files.

ATTR_HIDDEN

2

Hidden file


рддрдкрд╛рдИрдБ рд▓реЛрдЬрд┐рдХрд▓ OR рдХрдерди рд╕рдБрдЧ рд╕рдВрдпреЛрдЬрд┐рдд рд╕рдореНрдмрдиреНрдзрд┐рдд рдорд╛рдирд╣рд░реВрджреНрд╡рд╛рд░рд╛ рдмрд╣реБ рд╡рд┐рд╢реЗрд╖рддрд╛рд╣рд░реВ рд╕реЗрдЯ рдЧрд░реНрди рд╕рдХреНрдиреБрд╣реБрдиреНрдЫ ред

рддреНрд░реБрдЯрд┐ рд╕рдЩреНрдХреЗрддрд╣рд░реВ

5 рдЕрд╡реИрдз рдХрд╛рд░реНрдп-рд╡рд┐рдзрд┐ рдХрд▓

53 рдлрд╛рдЗрд▓ рдлреЗрд▓рд╛ рдкрд░реЗрди

70 рдЕрдиреБрдорддрд┐ рдЕрд╕реНрд╡рд┐рдХрд╛рд░ рдЧрд░рд┐рдпреЛ

Example:


Sub ExampleSetGetAttr
 On Error GoTo ErrorHandler ' рддреНрд░реБрдЯрд┐ рд╣реНрдпрд╛рдиреНрдбрд▓рд░рдХрд╛ рд▓рд╛рдЧрд┐ рд▓рдХреНрд╖реНрдп рдкрд░рд┐рднрд╛рд╖рд┐рдд рдЧрд░реНрдиреБрд╣реЛрд╕реН
 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!