在 Windows 中查詢及設定檔的要求狀態Query and set Files On-Demand states in Windows

隨著 OneDrive 檔的要求,檔案可以是三種狀態的其中一種。With OneDrive Files On-Demand, files can be in one of three states. 這兩種狀態都會對應至檔案屬性狀態。Each of these states corresponds to a file attribute state. 若要查詢檔或資料夾目前的狀態,請使用下列命令:To query the current state of a file or folder, use the following command:

  • 惡性 <Path to file or folder>attrib <Path to file or folder>

腳本化命令Scriptable commands

使用下列命令來設定檔和資料夾狀態。Use the following commands to set file and folder states.

檔隨選狀態Files On-Demand state 檔案屬性狀態File attribute state CommandCommand
永遠可用Always available
寄託Pinned
attrib + p <path>attrib +p <path>
本機可用Locally available
ClearpinClearpin
attrib-p <path>attrib -p <path>
僅限線上Online-only
駐留Unpinned
attrib + u <path>attrib +u <path>

注意

固定僅限線上的檔案會讓同步應用程式下載檔案內容,而取消固定已下載的檔案會在本機儲存檔內容時,釋放裝置上的空間。Pinning an online-only file makes the sync app download the file contents, and unpinning a downloaded file frees up space on the device by not storing the file contents locally.
若要將僅限線上的檔案或資料夾設定為「本機可用」,您必須先將其設為「永遠可用」。To set an online-only file or folder to "locally available," you must first set it to "always available."
如果您符合 同步應用程式需求 ,但仍無法在 [設定] 中看到 [按需求] 選項,請確定服務 "Windows Cloud Files Filter Driver" 啟動類型已設定為 2 (AUTO_START) 。If you meet the Sync app requirements and still can't see the Files On-Demand option under "Settings", make sure the service "Windows Cloud Files Filter Driver" start type is set to 2 (AUTO_START). 啟用此功能會將下列登錄機碼值設為 2。[HKLM\SYSTEM\CurrentControlSet\Services\CldFlt]"Start"="dword:00000002"Enabling this feature sets the following registry key value to 2.[HKLM\SYSTEM\CurrentControlSet\Services\CldFlt]"Start"="dword:00000002"