METHODLIST.BTM - List Methods for an ActiveX (COM) Object

#1
Code:
::--------------------------------------------------------------------
:: METHODLIST.BTM
::
:: List Methods for an ActiveX (COM) Object from the CLI
::
:: TCC 15.01.52
:: 2013/07/22
:: Joe Caverly
::
:: TODO: Error checking of command line arguments, misc. stuff.
::--------------------------------------------------------------------
@setlocal
@echo off

iff %# eq 1 then
  gosub psscript
else
  echo USAGE: methodlist msscriptcontrol.scriptcontrol
  echo        methodlist shell.application
  quit
endiff

if exist methodlist.ps1 del methodlist.ps1 > nul

:: Pipes are used in the PowerShell Script,
::   TCC does not like this.
::   Disable | and treat it like text.
setdos /X-5

do i = %start to %end
  echo %@line[%_batchname,%i] >> methodlist.ps1
enddo

powershell methodlist.ps1

if exist methodlist.ps1 del methodlist.ps1 > nul
endlocal
quit

:psscript
set start=%@eval[%_batchline+1]
text > nul
$Method = New-Object -ComObject %1
$Method | get-member
endtext
set end=%@eval[%_batchline-3]
return