> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IXtfFileIOClient::SetFileAttributes 方法

> IXtfFileIOClient::SetFileAttributes 方法

# IXtfFileIOClient::SetFileAttributes 方法

設定開發主機上檔案的屬性。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
public:
HRESULT SetFileAttributes(
         LPCWSTR pszSearchPattern,
         DWORD dwIncludeAttributes,
         DWORD dwExcludeAttributes,
         DWORD dwRecursionLevels,
         DWORD dwAddAttributes,
         DWORD dwRemoveAttributes,
         IXtfFindFileCallback *pCallback
)  
```

<a id="parametersSection" />

### 參數

*pszSearchPattern*\
類型：LPCWSTR

指向搜尋模式的指標，該模式定義要設定其屬性之檔案的檔案名稱。此參數接受萬用字元，以比對符合所指示模式的字串。

*dwIncludeAttributes*\
類型：DWORD

要納入作業之檔案屬性的位元 OR 組合。如需可能的屬性清單，請參閱[檔案屬性常數](https://msdn.microsoft.com/library/windows/desktop/gg258117\(v=vs.85\).aspx)。

*dwExcludeAttributes*\
類型：DWORD

要從作業中排除之檔案屬性的位元 OR 組合。如需可能的屬性清單，請參閱[檔案屬性常數](https://msdn.microsoft.com/library/windows/desktop/gg258117\(v=vs.85\).aspx)。

*dwRecursionLevels*\
類型：DWORD

作業要遞迴的目錄層級數目。

*dwAddAttributes*\
類型：DWORD

要新增至檔案之檔案屬性的位元 OR 組合。

*dwRemoveAttributes*\
類型：DWORD

要從檔案移除之檔案屬性的位元 OR 組合。

*pCallback*\
類型：IXtfFindFileCallback\*

指向找到要設定其屬性的檔案時所要呼叫之 [IXtfFindFileCallback](/zh-TW/reference/tools/xtf/xtffileio/classes/IXtfFindFileCallback/ixtffindfilecallback-xtffileio-xbox-microsoft-t) 回呼的指標。

<a id="retvalSection" />

### 傳回值

類型：HRESULT

如果成功，則傳回 `S_OK`；否則傳回 HRESULT 錯誤碼。

<a id="remarksSection" />

## 備註

此函式會設定開發主機上指定檔案的檔案屬性。如果發生錯誤，此函式會傳回 HRESULT 錯誤碼。如需 XBOX Tools Framework (XTF) API 特有之 HRESULT 錯誤碼的詳細資訊，請參閱 [XTF 傳輸錯誤 (NDA 主題)](/zh-TW/tools/tools-console/commandlinetools/xtf-transport-errors)。

使用 [IXtfFileIOClient::GetFileAttributes](/zh-TW/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/setfileattributes-ixtffileioclient-xtffileio-xbox-microsoft-m) 方法來取得開發主機上指定檔案的檔案屬性。

<a id="requirementsSection" />

## 需求

**標頭：** xtffileio.h

**程式庫：** xtffileio.lib

**支援的平台：** Windows (適用於 XBOX 主機工具)

<a id="seealsoSection" />

## 另請參閱

[IXtfFileIOClient 介面](/zh-TW/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/ixtffileioclient-xtffileio-xbox-microsoft-t)\
[XtfFileIO](/zh-TW/reference/tools/xtf/xtffileio/xtffileio-xbox-microsoft-n)


## Related topics

- [IXtfFileIOClient::GetFileAttributes Method](/zh-CN/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/getfileattributes-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::SetFileAttributes Method](/zh-CN/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/setfileattributes-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::SetFileAttributes (método)](/es/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/setfileattributes-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::SetFileAttributes 메서드](/ko/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/setfileattributes-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::SetFileAttributes メソッド](/ja-jp/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/setfileattributes-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
