Option Explicit Dim objFSO,objTxt,objShell Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") Set objTxt = objFSO.OpenTextFile("Reg_ShowSubKey_DisplayName0.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\CurrentVersion\Uninstall\" 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall ShowSubKeyDisplayName HKLM objTxt.Close Set objTxt = Nothing mySort objShell.Run "Reg_ShowSubKey_DisplayName1.txt" Set objFSO = Nothing Set objShell = Nothing '********************************************************* 'サブキーの DisplayName を列挙 '********************************************************* Sub ShowSubKeyDisplayName(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 strSubKey '配列arrSubKeysからサブキー名を読み取り Dim intRet 'サブキーのStringValueを読み取り Dim strValue ' For Each strSubKey In arrSubKeys intRet = objReg.GetStringValue(strHive, strBaseKey & strSubKey, "DisplayName", strValue) If intRet <> 0 Then intRet = objReg.GetStringValue(strHive, strBaseKey & strSubKey, "QuietDisplayName", strValue) End If If (strValue <> "") and (intRet = 0) Then objTxt.WriteLine strValue End If Next End Sub '********************************************************* 'Sub mySort '********************************************************* Sub mySort objShell.Run "cmd.exe /c sort ""Reg_ShowSubKey_DisplayName0.txt"">""Reg_ShowSubKey_DisplayName1.txt""" objShell.Run "cmd.exe /c del ""Reg_ShowSubKey_DisplayName0.txt""", 7 End Sub '********************************************************* 'Sub mySort2 '********************************************************* Sub mySort2 objShell.Exec "sort ""Reg_ShowSubKeyDisplayName0.txt"">""Reg_ShowSubKeyDisplayName1.txt""" objShell.Exec "cmd.exe /c del ""Reg_ShowSubKeyDisplayName0.txt""" End Sub