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 ។

Error codes:

5 ការ​ហៅ​បែបបទ​មិន​ត្រឹមត្រូវ

53 រក​មិន​ឃើញ​ឯកសារ

70 ការ​ចូល​ដំណើរការ​ត្រូវ​បាន​បដិសេធ

Example:


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