ホーム 暮らし Differences between the 'Local', 'LocalLow', and 'Roaming' folders under AppData

Differences between the 'Local', 'LocalLow', and 'Roaming' folders under AppData

三浦 拓海 三浦 拓海 • 更新: • 公開: • 読了約 9 分
目次

There are three folders directly under the Windows AppData folder: 'Local', 'LocalLow', and 'Roaming'.

What are the differences between them?

Purpose of the Local/LocalLow and Roaming folders

ndbc2e7ca4fb7

The 'Local' and 'LocalLow' folders store personal settings (local settings).
They are used for files that are large in size and would be too burdensome to move along with the user.

Local and LocalLow are distinguished by the trust level of the accessing process.
Processes with a relatively higher risk level are intended to use LocalLow.

These folders were located at %USERPROFILE%\Local Settings in Windows XP.


The 'Roaming' folder stores application data.
It is used for files that can move with the user to another computer.

In Windows XP, this was located at %USERPROFILE%\Application Data.

Appendix - How to retrieve each folder in C#

You can retrieve them using either of the following methods.

  • Using the Environment.GetFolderPath method

  • Retrieving from environment variables

Retrieving the Roaming folder

Specify Environment.SpecialFolder.ApplicationData as the argument for the GetFolderPath method.

var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);
// → C:\Users\username\AppData\Roaming

You can also retrieve it from the 'APPDATA' environment variable.

var path = System.Environment.GetEnvironmentVariable("APPDATA");
// → C:\Users\username\AppData\Roaming
Retrieving the Local folder

Specify Environment.SpecialFolder.LocalApplicationData as the argument for the GetFolderPath method.

var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData);
// → C:\Users\username\AppData\Local

You can also retrieve it from the 'LOCALAPPDATA' environment variable.

var path = System.Environment.GetEnvironmentVariable("LOCALAPPDATA");
// → C:\Users\username\AppData\Local
Retrieving the LocalLow folder

Since the Environment.SpecialFolder enumeration does not have a field representing the LocalLow folder, it cannot be retrieved directly using the GetFolderPath method.

Also, the LocalLow folder is not defined in the environment variables.

Therefore, you need to take an extra step to retrieve the LocalLow folder.

For example, append "Low" to the Local path.
Alternatively, retrieve the Roaming path and then replace the Roaming portion with LocalLow.

The former method of appending "Low" is likely safer.
The replacement method could result in unintended parts being changed to LocalLow if "Roaming" appears elsewhere in the path.
Well, I suppose that is highly unlikely, though.


Sample for appending "Low"

var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "Low";
// → C:\Users\username\AppData\LocalLow


Sample for replacing "Roaming" with "LocalLow"

var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData)
                             .Replace("Roaming", "LocalLow");
// → C:\Users\username\AppData\LocalLow


One might wonder if there are many opportunities to use the LocalLow folder, but this is fine for now.


Reference pages

  • Store and retrieve settings and other app data - Windows apps | Microsoft Learn

  • Part 2: XP/Vista to Windows 7 Complete Migration Manual: The New Era of Windows 7 (Page 1/6) - @IT


同じカテゴリの記事

三浦 拓海
コンテンツディレクター 三浦 拓海
プロフィールを見る →

映画と連続ドラマの公開情報を追う担当。配給会社のプレスシートと公式サイトの発表日を確認したうえで執筆します。

おすすめの関連記事