※ 画像は、WindowsXP で実行しています。Windows 2000では、CommandLine は実装されていません Set Fs = CreateObject( "Scripting.FileSystemObject" ) Set WshShell = CreateObject( "WScript.Shell" ) Set OutFile = Fs.OpenTextFile( "ProcessList.htm", 2, True ) strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set col = objWMIService.ExecQuery _ ("Select * from Win32_Process") result = "" OutFile.WriteLine "<HTML><HEAD><TITLE>ProcessList</TITLE>" OutFile.WriteLine "<META http-equiv=""Content-Type"" content=""text/html; charset=shift_jis"">" OutFile.WriteLine "<STYLE type=""text/css"">* { font-size:12px;}</STYLE>" OutFile.WriteLine "</HEAD><BODY>" OutFile.WriteLine "<TABLE>" OutFile.WriteLine "<TR>" OutFile.WriteLine "<TH>名称</TH>" OutFile.WriteLine "<TH>パス</TH>" OutFile.WriteLine "<TH>コマンドライン</TH>" OutFile.WriteLine "</TR>" nCnt = 0 For Each obj in col OutFile.WriteLine "<TR>" strCss = "" if nCnt Mod 2 = 0 then strCss = "style='background-color:#D0D0D0;'" end if OutFile.WriteLine "<TD nowrap " & strCss & "><B>" & obj.Caption & "</b></TD>" OutFile.WriteLine "<TD nowrap " & strCss & ">" & obj.ExecutablePath & "</TD>" on error resume next OutFile.WriteLine "<TD nowrap " & strCss & ">" & obj.CommandLine & "</TD>" on error goto 0 OutFile.WriteLine "</TR>" nCnt = nCnt + 1 Next OutFile.WriteLine "</TABLE></BODY></HTML>" OutFile.Close WshShell.Run( "RunDLL32.EXE shell32.dll,ShellExec_RunDLL " & "ProcessList.htm" ) |