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

Please support us!