RegistryValueOptions 列挙体
この列挙体には、メンバ値のビットごとの組み合わせを可能にする FlagsAttribute 属性が含まれています。
名前空間: Microsoft.Win32アセンブリ: mscorlib (mscorlib.dll 内)

<FlagsAttribute> _ Public Enumeration RegistryValueOptions

メンバ名 | 説明 | |
---|---|---|
DoNotExpandEnvironmentNames | RegistryValueKind.ExpandString 型の値が、埋め込まれた環境変数を展開せずに取得されます。 | |
None | オプションの動作は指定されていません。 |

RegistryKey.GetValue(String,Object,RegistryValueOptions) メソッド オーバーロードで DoNotExpandEnvironmentNames フラグを使用します。

テスト キーを作成し、埋め込まれた環境変数を使用して値を追加し、展開された形式と展開されていない形式の両方で値を取得するコード例を次に示します。
Imports System Imports Microsoft.Win32 Imports Microsoft.VisualBasic Public Class Example Public Shared Sub Main() ' Delete and recreate the test key. Registry.CurrentUser.DeleteSubKey("RegistryValueOptionsExample", False) Dim rk As RegistryKey = _ Registry.CurrentUser.CreateSubKey("RegistryValueOptionsExample") ' Add a value that contains an environment variable. rk.SetValue("ExpandValue", "The path is %PATH%", _ RegistryValueKind.ExpandString) ' Retrieve the value, first without expanding the environment ' variable and then expanding it. Console.WriteLine("Unexpanded: ""{0}""", _ rk.GetValue("ExpandValue", "No Value", _ RegistryValueOptions.DoNotExpandEnvironmentNames)) Console.WriteLine("Expanded: ""{0}""", rk.GetValue("ExpandValue")) End Sub 'Main End Class 'Example
using System; using Microsoft.Win32; using Microsoft.VisualBasic; public class Example { public static void Main() { // Delete and recreate the test key. Registry.CurrentUser.DeleteSubKey("RegistryValueOptionsExample", false); RegistryKey rk = Registry.CurrentUser.CreateSubKey("RegistryValueOptionsExample"); // Add a value that contains an environment variable. rk.SetValue("ExpandValue", "The path is %PATH%", RegistryValueKind.ExpandString); // Retrieve the value, first without expanding the environment // variable and then expanding it. Console.WriteLine("Unexpanded: \"{0}\"", rk.GetValue("ExpandValue", "No Value", RegistryValueOptions.DoNotExpandEnvironmentNames)); Console.WriteLine("Expanded: \"{0}\"", rk.GetValue("ExpandValue")); } //Main } //Example
#using <Microsoft.VisualBasic.dll> using namespace System; using namespace Microsoft::Win32; using namespace Microsoft::VisualBasic; int main() { // Delete and recreate the test key. Registry::CurrentUser->DeleteSubKey( L"RegistryValueOptionsExample", false ); RegistryKey ^ rk = Registry::CurrentUser->CreateSubKey( L"RegistryValueOptionsExample" ); // Add a value that contains an environment variable. rk->SetValue( L"ExpandValue", L"The path is %PATH%", RegistryValueKind::ExpandString ); // Retrieve the value, first without expanding the environment // variable and then expanding it. Console::WriteLine( L"Unexpanded: \"{0}\"", rk->GetValue( L"ExpandValue", L"No Value", RegistryValueOptions::DoNotExpandEnvironmentNames ) ); Console::WriteLine( L"Expanded: \"{0}\"", rk->GetValue( L"ExpandValue" ) ); return 0; } //Main
import System.*; import Microsoft.Win32.*; import Microsoft.VisualBasic.*; public class Example { public static void main(String args[]) { // Delete and recreate the test key. Registry.CurrentUser.DeleteSubKey("RegistryValueOptionsExample", false); RegistryKey rk = Registry.CurrentUser.CreateSubKey( "RegistryValueOptionsExample"); // Add a value that contains an environment variable. rk.SetValue("ExpandValue", "The path is %PATH%", RegistryValueKind.ExpandString); // Retrieve the value, first without expanding the environment // variable and then expanding it. Console.WriteLine("Unexpanded: \"{0}\"", rk.GetValue("ExpandValue", "No Value", RegistryValueOptions.DoNotExpandEnvironmentNames)); Console.WriteLine("Expanded: \"{0}\"", rk.GetValue("ExpandValue")); } //main } //Example

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- RegistryValueOptions 列挙体のページへのリンク