インストール済みアプリの一覧をテキスト出力
意外と良いツールが無かったので作った。
拡張子vbsで実行するとデスクトップにcsvが作成される。
set sh = createobject("wscript.shell") set fso = createobject("scripting.filesystemobject") set regex = new regexp set dic = createobject("scripting.dictionary") const TemporaryFolder = 2 outfilename = fso.GetSpecialFolder(TemporaryFolder) & "\" & fso.GetTempName() & ".csv" set outfile = fso.CreateTextFile(outfilename) set regquery = sh.exec("reg query ""HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"" /s") set instream = regquery.StdOut 'ヘッダ出力 wantedName = array("DisplayName", "Publisher", "DisplayVersion", "InstallDate") for each name in wantedName outfile.write name & "," next outfile.write vbcrlf 'Main do line = instream.readline() if instr(line, "HKEY_LOCAL_MACHINE") > 0 then '1アプリスタート dic.RemoveAll elseif len(line) = 0 then '1アプリ終わり outResult else setData line end if loop while (not instream.AtEndOfLine) or regquery.status = 0 outfile.close fso.copyfile outfilename, sh.SpecialFolders("desktop") & "\appinfo.csv" sub outResult() for each name in wantedName outfile.write """" & dic(name) & """," next outfile.write vbcrlf end sub sub setData(line) regex.Pattern = "^ *([^ ]+) +REG_[^ ]+ +(.*$)" set matches = regex.Execute(line) if matches.count > 0 then set match = matches(0) else exit sub end if 'outfile.writeline line & " DEBUG" dic(match.SubMatches(0)) = match.SubMatches(1) end sub