- Aug
- 2,027
- 82
Code:
::--------------------------------------------------------------------
:: COMLIST.BTM
::
:: Display A Complete List Of Registered Objects
:: On Your Windows System
::
:: TCC 15.01.52
:: 2013/07/22
:: Joe Caverly
::
:: Requires PowerShell, works with PowerShell 2.0
::
:: TODO: Error checking of command line arguments, misc. stuff.
::
:: Examples:
:: comlist
:: comlist | view
:: comlist shell
:: comlist wscript.shell
:: comlist msscriptcontrol.scriptcontrol
::--------------------------------------------------------------------
@setlocal
@echo off
:: Pipes are used in the PowerShell Script,
:: TCC does not like this.
:: Disable | and treat it like text.
setdos /X-5
switch %#
case 1
gosub 1arg
default
gosub 0arg
endswitch
if exist comlist.ps1 del comlist.ps1 > nul
do i = %start to %end
echo %@line[%_batchname,%i] >> comlist.ps1
enddo
powershell comlist.ps1
if exist comlist.ps1 del comlist.ps1 > nul
endlocal
quit
:0arg
set start=%@eval[%_batchline+1]
text > nul
function com_list
{
$path = "REGISTRY::HKey_Classes_Root\clsid\*\progid"
foreach ($val in dir $path)
{
$val.getvalue("")
}
}
com_list
endtext
set end=%@eval[%_batchline-3]
return
:1arg
set start=%@eval[%_batchline+1]
text > nul
function com_list
{
$path = "REGISTRY::HKey_Classes_Root\clsid\*\progid"
foreach ($val in dir $path)
{
$val.getvalue("")
}
}
com_list | select-string %1
endtext
set end=%@eval[%_batchline-3]
return