Option Explicit Dim objFSO,objTxt,objShell Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") Set objTxt = objFSO.OpenTextFile("Reg_Show_SubKeys1.txt", 8, true, -2) Set objShell = WScript.CreateObject("WScript.Shell") Dim strComputer 'ホスト名(ローカル コンピュータ) strComputer = "." 'HKLM = &H80000002 ハイブを指定 Const HKLM = &H80000002 'Const HKCU = &H80000001 'strBaseKey = キーを指定 Const strBaseKey = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\" 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options ShowSubKeyName HKLM objTxt.Close objShell.Run "Reg_Show_SubKeys1.txt" Set objTxt = Nothing Set objFSO = Nothing Set objShell = Nothing '********************************************************* 'サブキー名を列挙 '********************************************************* Sub ShowSubKeyName(strHive) Dim objReg ' オブジェクト Regestryプロバイダ Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "/root/default:StdRegProv") Dim strRegHive 'ハイブ名 If strHive = &H80000002 Then strRegHive = "HKLM" If strHive = &H80000001 Then strRegHive = "HKCU" objTxt.WriteLine "============================================================" objTxt.WriteLine strRegHive & "\" & strBaseKey objTxt.WriteLine "============================================================" Dim arrSubKeys 'サブキー名を配列に格納 objReg.EnumKey strHive, strBaseKey, arrSubKeys Dim x For x=0 To UBound(arrSubKeys) objTxt.WriteLine arrSubKeys(x) Next End Sub