RegistryValueOptions 列挙体とは? わかりやすく解説

RegistryValueOptions 列挙体

メモ : この列挙体は、.NET Framework version 2.0新しく追加されたものです。

レジストリ キーから名前/値ペア取得するときのオプション動作指定します

この列挙体には、メンバ値のビットごとの組み合わせ可能にする FlagsAttribute 属性含まれています。

名前空間: Microsoft.Win32
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<FlagsAttribute> _
Public Enumeration RegistryValueOptions
Dim instance As RegistryValueOptions
[FlagsAttribute] 
public enum RegistryValueOptions
[FlagsAttribute] 
public enum class RegistryValueOptions
/** @attribute FlagsAttribute() */ 
public enum RegistryValueOptions
FlagsAttribute 
public enum RegistryValueOptions
メンバメンバ
 メンバ説明
DoNotExpandEnvironmentNamesRegistryValueKind.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 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Microsoft.Win32 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「RegistryValueOptions 列挙体」の関連用語

RegistryValueOptions 列挙体のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



RegistryValueOptions 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS