Powershell 有关使用COM对象成员的必需示例

Powershell 有关使用COM对象成员的必需示例,powershell,Powershell,我不熟悉powershell和Windows COM对象 我能够获得特定COM对象(例如Internet Explorer)的成员,如下所示: $ie = New-Object -com internetexplorer.application $ie | get-member TypeName: System.__ComObject#{d30c1661-cdaf-11d0-8a3e-00c04fc9e26e} Name MemberType Definit

我不熟悉powershell和Windows COM对象

我能够获得特定COM对象(例如Internet Explorer)的成员,如下所示:

$ie = New-Object -com internetexplorer.application
$ie | get-member
   TypeName: System.__ComObject#{d30c1661-cdaf-11d0-8a3e-00c04fc9e26e}
Name                 MemberType Definition
----                 ---------- ----------
ClientToWindow       Method     void ClientToWindow (int, int)
ExecWB               Method     void ExecWB (OLECMDID, OLECMDEXECOPT, Variant, Variant)
GetProperty          Method     Variant GetProperty (string)
GoBack               Method     void GoBack ()
但我在哪里可以得到每个成员的详细使用费?
我的意思是,如何在powershell脚本中(以详细的方式)使用特定的成员,例如GoBack或Busy或任何其他成员。像这样使用get成员将为您提供您能够获得的所有信息。不幸的是,COM对象没有“Get-Help iexplore”,因为它们是“黑匣子”,您只能看到它们确定为公共的方法和属性

有时候,你可以通过推理和实验来让事情顺利进行。例如

#Create a new Internet explorer object
$ie = New-Object -com internetexplorer.application

#Show the Internet Explorer window
$ie.Visible = $true

#Navigate to Google
$ie.Navigate("http://google.com")

#Navigate to Yahoo
$ie.Navigate("http://yahoo.com")

#Go back to google
$ie.GoBack()
对于任何更复杂的事情,搜索谷歌通常是我要做的第一件事。例如,一些链接:

  • 是的。。这样做(在谷歌上进行实验和搜索)。感谢您的回复和链接:)