| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
| 3 |
<html> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| 6 |
<title>setfileattr</title> |
| 7 |
<meta http-equiv="Content-Style-Type" content="text/css"> |
| 8 |
<link rel="stylesheet" href="../../style.css" type="text/css"> |
| 9 |
</head> |
| 10 |
|
| 11 |
<body> |
| 12 |
|
| 13 |
|
| 14 |
<h1>setfileattr</h1> |
| 15 |
|
| 16 |
<p> |
| 17 |
Sets attributes of a file or directory. <em>(version 4.69 or later)</em> |
| 18 |
</p> |
| 19 |
|
| 20 |
<pre class="macro-syntax"> |
| 21 |
setfileattr <filename> <attributes> |
| 22 |
</pre> |
| 23 |
|
| 24 |
<h2>Parameters</h2> |
| 25 |
|
| 26 |
<dl> |
| 27 |
<dt class="macro">string <filename></dt> |
| 28 |
<dd>The file name or directory name</dd> |
| 29 |
|
| 30 |
<dt class="macro">integer <attributes></dt> |
| 31 |
<dd>A user can specify a attribute value combined in the following:<br> |
| 32 |
<table border="2"> |
| 33 |
<tr> |
| 34 |
<th>Value</th> |
| 35 |
<th>Meaning</th> |
| 36 |
</tr> |
| 37 |
<tr> |
| 38 |
<td>$1</td> |
| 39 |
<td>Read only</td> |
| 40 |
</tr> |
| 41 |
<tr> |
| 42 |
<td>$2</td> |
| 43 |
<td>Hidden</td> |
| 44 |
</tr> |
| 45 |
<tr> |
| 46 |
<td>$4</td> |
| 47 |
<td>The operating system uses a part of, or uses exclusively</td> |
| 48 |
</tr> |
| 49 |
<tr> |
| 50 |
<td>$20</td> |
| 51 |
<td>Archive</td> |
| 52 |
</tr> |
| 53 |
<tr> |
| 54 |
<td>$80</td> |
| 55 |
<td>Not have other attributes set<br> |
| 56 |
Enabled when the value is independently specified.</td> |
| 57 |
</tr> |
| 58 |
<tr> |
| 59 |
<td>$100</td> |
| 60 |
<td>Temporary</td> |
| 61 |
</tr> |
| 62 |
<tr> |
| 63 |
<td>$1000</td> |
| 64 |
<td>Physically moved to offline storage(Windows 2000 or later)</td> |
| 65 |
</tr> |
| 66 |
<tr> |
| 67 |
<td>$2000</td> |
| 68 |
<td>Not to be indexed by the content indexing service(Windows 2000 or later)</td> |
| 69 |
</tr> |
| 70 |
</table> |
| 71 |
</dd> |
| 72 |
</dl> |
| 73 |
|
| 74 |
<h2>Return Value</h2> |
| 75 |
|
| 76 |
<dl> |
| 77 |
<dt class="macro">System variable <result></dt> |
| 78 |
<dd>When the command fails, 0 is stored.<br> |
| 79 |
When the command succeeds, 1 is stored.</dd> |
| 80 |
</dl> |
| 81 |
|
| 82 |
<h2>Example</h2> |
| 83 |
|
| 84 |
<pre class="macro-example"> |
| 85 |
; add readonly attribute |
| 86 |
file = 'c:\test.txt' |
| 87 |
getfileattr file |
| 88 |
attr = result | $1 ; keep current attributes |
| 89 |
setfileattr file attr |
| 90 |
</pre> |
| 91 |
|
| 92 |
<h2>See also</h2> |
| 93 |
<ul> |
| 94 |
<li><a href="getfileattr.html">getfileattr</a></li> |
| 95 |
<li>MSDN Library <a href="http://msdn.microsoft.com/en-us/library/aa365535(v=VS.85).aspx" target="_blank">SetFileAttributes</a></li> |
| 96 |
<li>MSDN Library <a href="http://msdn.microsoft.com/en-us/library/gg258117(v=VS.85).aspx" target="_blank">File Attribute Constants</a></li> |
| 97 |
</ul> |
| 98 |
|
| 99 |
</body> |
| 100 |
</html> |