Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for progids.vbs

(view source code of progids.vbs as plain text)

  1. Option Explicit
  2.  
  3. Const HKEY_CLASSES_ROOT = &H80000000
  4.  
  5. Dim arrProgID, lstProgID, objReg, strMsg, strProgID, strSubKey, subKey, subKeys()
  6.  
  7. If WScript.Arguments.Count > 0 Then
  8. 	strMsg = "ProgIDs.vbs,  Version 1.00"                       & vbCrLf _
  9. 	       & "List all ProgIDs available on the local computer" & vbCrLf & vbCrLf _
  10. 	       & "Based on a PowerShell script on www.readify.net"  & vbCrLf & vbCrLf _
  11. 	       & "Usage:  " & WScript.ScriptName                    & vbCrLf & vbCrLf _
  12. 	       & "Written by Rob van der Woude"                     & vbCrLf _
  13. 	       & "http://www.robvanderwoude.com"
  14. 	WScript.Echo strMsg
  15. End If
  16.  
  17. Set lstProgID = CreateObject( "System.Collections.ArrayList" )
  18. Set objReg    = GetObject( "winmgmts://./root/default:StdRegProv" )
  19.  
  20. ' List all subkeys of HKEY_CLASSES_ROOT\CLSID
  21. objReg.EnumKey HKEY_CLASSES_ROOT, "CLSID", subKeys
  22.  
  23. ' Loop through the list of subkeys
  24. For Each subKey In subKeys
  25. 	' Check each subkey for the existence of a ProgID
  26. 	strSubKey = "CLSID\" & subKey & "\ProgID"
  27. 	objReg.GetStringValue HKEY_CLASSES_ROOT, strSubKey, "", strProgID
  28. 	' If a ProgID exists, add it to the list
  29. 	If Not IsNull( strProgID ) Then lstProgID.Add strProgID
  30. Next
  31.  
  32. ' Sort the list of ProgIDs
  33. lstProgID.Sort
  34.  
  35. ' Copy the list to an array (this makes displaying it much easier)
  36. arrProgID = lstProgID.ToArray
  37.  
  38. ' Display the entire array
  39. WScript.Echo Join( arrProgID, vbCrLf )
  40.  

page last uploaded: 2017-08-21, 14:26