特殊文件夹

特殊文件夹(英语:Special Folder),指那些不是绝对文件路径的文件夹。 这使得应用程序将询问系统某一类别文件的合适位置成为了可能,且不受版本和语言的系统限制。

概要

Windows 95开始,Windows 使用「特殊文件夹」的概念来代表保存在计算机中的内容,这使得用户无需再处理绝对文件路径,并且可以在不同系统以及不同应用程序之间修改。后续各版本 Windows 均对此功能作出了改进。

微软的“为Windows而设计”(Designed for Windows)标志要求程序必须使用特殊文件夹来保存文档和设置。

一个特殊文件夹可以被映射于一个物理地址,或一个“特殊的”文件夹。因此,特殊文件夹与环境变量相似。 事实上,很多在用户层面设置的环境变量是由特殊文件夹的指向来决定的。

然而,特殊文件夹事实上不存在于文件系统中——他们代表了Windows资源管理器中的树形文件夹导航。这与Windows Shell namespace(Windows Shell 命名空间)类似。然而在Windows XP系统中,根级的命名空间是桌面:它包含了我的文档,我的电脑,网上邻居回收站。一些与特殊文件夹相关联的文件夹在物理上也确实存在。Windows资源管理器将特殊文件夹以及它的关联文件夹合并起来显示。例如“桌面”保存在用户个人文件夹中。

特殊文件夹列表

下表列出了从Windows Vista起可用的大多数文件系统和虚拟文件夹。还给出了引入每个特殊文件夹的操作系统版本。比如说,“%USERPROFILE%”和“%windir%”这样的项目是Windows环境变量

特殊文件夹 用处 默认位置
Application Data 来储存每个用户的应用程序的特定文件
Windows 98Windows Me
%windir%\Application Data
Windows 2000Windows XP
%USERPROFILE%\Application Data
Windows Vista 及更高版本上
%APPDATA%
公文包 用于在移动硬件上面同步文件
Windows 95、Windows 98 和 Windows Me 上
%windir%\Desktop
在 Windows 2000 及更高版本上,默认情况下不创建,但可以在任何文件夹中创建。公文包和公文包浏览器外壳扩展 (SyncUI.dll) 中的Desktop.ini隐藏系统文件包含其功能。在 Windows 10 版本 1703 及更高版本中删除。
Cookies IE浏览器的缓存
在 Windows 98 和 Windows Me 上
%windir%\Cookies
在 Windows 2000 及更高版本上
%USERPROFILE%\Cookies
在 Windows Vista 及更高版本上
%APPDATA%\Microsoft\Windows\Cookies
桌面目录 包含储存在电脑桌面上的文件
在 Windows 95、Windows 98 和 Windows Me 上
%windir%\Desktop
在 Windows 2000 及更高版本上
%USERPROFILE%\Desktop
收藏夹 用户收藏的文件
在 Windows 98 和 Windows Me 上
%windir%\Favorites
在 Windows 2000 及更高版本上
%USERPROFILE%\Favorites
字体 包含已安装的字体 %windir%\Fonts
历史 用于储存用户的浏览器历史记录 %USERPROFILE%\Local Settings\History
Internet Cache 用储存于用户的 Internet 临时文件
在 Windows 98 和 Windows Me 上

%windir%\Temporary Internet Files

在 Windows 2000 和 Windows XP 上

%USERPROFILE%\Local Settings\Temporary Internet Files

在 Windows Vista 和 Windows 7

%LOCALAPPDATA%\Microsoft\Windows\Temporary Internet Files

Windows 8 及更高版本上

%LOCALAPPDATA%\Microsoft\Windows\INetCache

Local Application Data 用于储存用户和特定于计算机的应用程序设置
在 Windows 98 和 Windows Me 上
%windir%\Application Data
在 Windows 2000 和 Windows XP 上
%USERPROFILE%\Local Settings\Application Data
在 Windows Vista 及更高版本上
%LOCALAPPDATA%
文档 用户储存的文档
在 Windows 98 和 Windows Me 上
C:\My Documents
在 Windows 2000 和 Windows XP 上
%USERPROFILE%\My Documents
在 Windows Vista 及更高版本上
%USERPROFILE%\Documents
音乐 用户储存的音乐
在 Windows 98 和 Windows Me 上
C:\My Documents\My Music
在 Windows 2000 和 Windows XP 上
%USERPROFILE%\My Documents\My Music
在 Windows Vista 及更高版本上
%USERPROFILE%\Music
图片 用户储存的图片
在 Windows 98 和 Windows Me 上
C:\My Documents\My Pictures
在 Windows 2000 和 Windows XP 上
%USERPROFILE%\My Documents\My Pictures
在 Windows Vista 及更高版本上
%USERPROFILE%\Pictures
视频 用户储存的视频
在 Windows 98 和 Windows Me 上
C:\My Documents\My Videos
在 Windows 2000 和 Windows XP 上
%USERPROFILE%\My Documents\My Videos
在 Windows Vista 及更高版本上
%USERPROFILE%\Videos

注意:

  • “桌面”虚拟文件夹与“桌面”特殊文件夹不是一回事。桌面虚拟文件夹是 Windows Shell 命名空间的根目录,其中包含其他虚拟文件夹。
  • “本地应用程序数据”与“应用程序数据”的不同之处在于,位于“本地”变体中的文件也旨在特定于它所在的计算机。仅当用户的配置文件是 Windows Server 域环境中的漫游配置文件时,这才有意义。
  • 与桌面一样,“我的文档”虚拟文件夹与“我的文档”特殊文件夹不同。如果要求提供虚拟文件夹变体,它将在文件对话框中显示为“桌面”虚拟文件夹的子目录,而不是用户的配置文件目录,因为它实际存在于硬盘驱动器上。
  • 如果“我的文档”文件夹被移动(例如,移动到网络驱动器),尝试通过 shell 变量访问它将转到原始的默认位置。

另见

参考文献

认识Windows的特殊文件夹—晓林 特殊文件夹的特殊用途—陈秀峰[失效連結]