// SystemRegistryNotExpand.cpp : メイン プロジェクト ファイルです。 #include "stdafx.h" using namespace System; using namespace Microsoft::Win32; int main(array ^args) { //レジストリからの読み取り RegistryKey^ regkey = Registry::CurrentUser->OpenSubKey( "Software\\test\\sub", false); if (regkey == nullptr) return 1; //REG_EXPAND_SZデータ型の値を取得する String^ stringValue; //展開して取得する stringValue = (String^)regkey->GetValue("ExpandString"); Console::WriteLine(stringValue); //展開せずに取得する stringValue = (String^)regkey->GetValue("ExpandString", "", RegistryValueOptions::DoNotExpandEnvironmentNames); Console::WriteLine(stringValue); //閉じる regkey->Close(); return 0; }