Win7,Win8中"XXX is not accessible"的問題(應用程式預設配置檔案儲存位置)
Windows 7, 8使用者在訪問ProgramData目錄和Documents and Settings目錄時,會無法開啟並被提示“C:\xxxx is not accessible. Access is denied.”因為許可權不足而被拒絕訪問。這是因為在Windows Vista以後的Windows作業系統中,預設的應用程式資料位置相對於使用廣泛的Windows XP已經被修改了,而這幾個目錄之所以存在時為了相容還試圖訪問它們的老程式。
它涉及了Documents and Settings和ProgramData下的所有檔案,其中包括配置目錄,快取目錄等等。
你完全不需要去使用某些工具或命令來獲取這些目錄的訪問許可權,因為我們可以很方便地去它們對應的路徑來訪問它們。
只是換了個位置
在Windows XP下預設儲存使用者資料(我的文件,我的音樂等)和應用程式配置,應用程式資料(Local Settings,Application Data等)被放在“Documents and Settings”目錄下,自Windows Vista開始,包括Windows 7,Windows 8, Windows 8.1 以及還未正式釋出的Windows 10,微軟對這個目錄結構左右一定的優化(簡化目錄名稱並去除空格,減小目錄深度,調整部分內容的劃分方式),使之更加易用和合理。
大體上,是講它們轉移到了C:\User目錄下。我在後面會給出完整的列表。
可能比較常用的是:
- HOME目錄從C:\Documents and Settings\<username>\ 變為 C:\Users\<username>\
- C:\Documents and Settings\<username>\Local Settings\ 變為 C:\Users\<username>\AppData\Local\
- C:\Documents and Settings\<username>\Application Data\ 變為 C:\Users\<username>\AppData\Roaming\
站在開發者的角度上“資料”和“配置”的劃分有時候會比較模糊,但是變為“本地資料”和“可漫遊資料”就好理解的多了。簡單的說:假設一個有網路同步功能的RPG遊戲,我分別在兩臺配置不同的機器上玩,不同機器我配置了不同的畫面特效級別,它們就是隻作用於本地的配置檔案,而我的遊戲進度則是應該漫遊在各個機器上的資料。
許可權
為了相容性考慮,微軟還保留了名為ProgramData,Documents and Settings等的幾個Junction Point(類似Linux的硬連結,沒有接觸過這個概念的朋友就當做是快捷方式好了),但是由於目錄的替換是完整的一一對映(使用者可以按照新方式找到所有檔案),而且從微軟的角度也不希望使用者在去使用舊的劃分方式,所以微軟將預設情況下將它們的read許可權設定為Everyone - Deny.
- 想看完整的Junction Point列表嗎?用管理員許可權開啟一個cmd,在系統盤輸入
dir /aL /s
。
完整對應表
Parent folder junction requirements:
Directory junction creation location | Destination |
---|---|
..\Documents and Settings\ | ..\Users\ |
User data legacy folder junction requirements:
Directory junction creation location | Destination |
---|---|
..\Documents and Settings\<username>\My Documents | ..\Users\<username>\Documents |
..\Documents and Settings\<username>\My Documents\My Music | ..\Users\<username>\Music |
..\Documents and Settings\<username>\My Documents\My Pictures | ..\Users\<username>\Pictures |
..\Documents and Settings\<username>\My Documents\My Videos | ..\Users\<username>\Videos |
Per-user Application Data legacy folder junction requirements:
Directory junction creation location | Destination |
---|---|
..\Documents and Settings\<username>\Local Settings\ | ..\Users\<username>\AppData\Local |
..\Documents and Settings\<username>\Local Settings\Application Data | ..\Users\<username>\AppData\Local |
..\Documents and Settings\<username>\Local Settings\Temporary Internet Files | ..\Users\<username>\AppData\Local\Microsoft\Windows\Temporary Internet Files |
..\Documents and Settings\<username>\Local Settings\History | ..\Users\<username>\AppData\Local\Microsoft\Windows\History |
..\Documents and Settings\<username>\Application Data\ | ..\Users\<username>\AppData\Roaming |
Per-user OS settings legacy folder junction requirements:
Directory junction creation location | Destination |
---|---|
..\Documents and Settings\<username>\Cookies\ | ..\Roaming\Microsoft\Windows\Cookies |
..\Documents and Settings\<username>\Recent | ..\Roaming\Microsoft\Windows\Recent |
..\Documents and Settings\<username>\Nethood\ | ..\Roaming\Microsoft\Windows\Network Shortcuts |
..\Documents and Settings\<username>\Printhood\ | ..\Roaming\Microsoft\Windows\Printer Shortcuts |
..\Documents and Settings\<username>\SendTo\ | ..\Roaming\Microsoft\Windows\Send To |
..\Documents and Settings\<username>\StartMenu\ | ..\Roaming\Microsoft\Windows\StartMenu |
..\Documents and Settings\<username>\Templates\ | ..\Roaming\Microsoft\Windows\Templates |
Legacy profile folders where junctions are not required:
Legacy location | Reasoning |
---|---|
..\Documents and Settings\<username>\Desktop | Covered by the junction at Documents and Settings |
..\Documents and Settings\<username>\Favorites | Covered by the junction at Documents and Settings |
..\Documents and Settings\<username>\Local Settings\Temp | Covered by the junction for the Local Settings folder to Local |
All Users legacy folder junction requirements:
Sym links creation location | Destination |
---|---|
..\Users\All Users | ..\ProgramData |
User junction points:
Directory junction creation location | Destination |
---|---|
..\ProgramData\Desktop | ..\Users\Public\Desktop |
..\ProgramData\Documents | ..\Users\Public\Documents |
..\ProgramData\Favorites | ..\Users\Public\Favorites |
..\Users\Public\Documents\My Music | ..\Users\Public\Music |
..\Users\Public\Documents\My Pictures | ..\Users\Public\Pictures |
..\Users\Public\Documents\My Videos | ..\Users\Public\Videos |
..\ProgramData\Application Data\ | ..\ProgramData |
..\ProgramData\Start Menu\ | ..\ProgramData\Microsoft\Windows\StartMenu |
..\ProgramData\Templates\ | ..\ProgramData\Microsoft\Windows\Templates |
Default User legacy folder junction requirements:
Directory junction creation location | Destination |
---|---|
..\Documents and Settings\Default User | ..\Users\Default |
..\Documents and Settings\Default User\Desktop | ..\Users\Default\Desktop |
..\Documents and Settings\Default User\My Documents | ..\Users\Default\Documents |
..\Documents and Settings\Default User\Favorites | ..\Users\Default\Favorites |
..\Documents and Settings\Default User\My Documents\My Music | ..\Users\Default\Music |
..\Documents and Settings\Default User\My Documents\My Pictures | ..\Users\Default\Pictures |
..\Documents and Settings\Default User\My Documents\My Videos | ..\Users\Default\Videos |
..\Documents and Settings\Default User\Application Data\ | ..\Users\Default\AppData\Roaming |
..\Documents and Settings\Default Users\Start Menu\ | ..\Users\Default\AppData\Roaming\Microsoft\Windows\StartMenu |
..\Documents and Settings\Default User\Templates\ | ..\Users\Default\AppData\Roaming\Microsoft\Windows\Templates |
Program Files junction points:
Directory junction creation location | Destination |
---|---|
..\Program Files (Localized name) | ..\Program Files |
..\Program Files\Common Files (Localized Name) | ..\Program Files\Local Files |
參考資料: