简体   繁体   English

PowerShell,对象=启动过程?

[英]PowerShell, Object = Start Process?

Hi I would like to start the Internet Explorer without extensions and control it. 嗨,我想启动不带扩展名的Internet Explorer并对其进行控制。 (Navigate to other pages, click buttons etc.) (导航到其他页面,单击按钮等。)

When I use the command: "Start iexplore.exe -ArgumentList -extoff" I have the IExplore without extensions, but no object. 当我使用以下命令时:“ Start iexplore.exe -ArgumentList -extoff”我的IExplore没有扩展名,但是没有对象。 I need the object to navigate to different pages and click buttons. 我需要该对象导航到不同的页面并单击按钮。 "$ie = Start iexplore.exe -ArgumentList -extoff" is not possible with the Command "Start X" 使用命令“启动X”无法使用“ $ ie =启动iexplore.exe -ArgumentList -extoff”

The following code create a Com Object and all I want is possible without the "Extensions = off" 下面的代码创建一个Com对象,而我所需要的一切都不需要“ Extensions = off”

  • $ie = New-Object -ComObject InternetExplorer.Application $ ie =新对象-ComObject InternetExplorer.Application
  • $ie.Navigate("http://www.stackoverflow.com") $ ie.Navigate(“ http://www.stackoverflow.com”)
  • $ie.Navigate("www.Navigate to a other Page.com") $ ie.Navigate(“ www.Navigate to other Page.com”)
  • $ie.Document.getElementById("ButtonID")|foreach{ $ ie.Document.getElementById(“ ButtonID”)| foreach {
  • $_.Click() $ _。Click()
  • } }

This is a real hack but you could tweak the COM startup commandline for IE to pass in the argument -extoff . 这是一个真正的技巧,但是您可以调整COM启动命令行以使IE传递参数-extoff The registry entry to start IE on my machine (with IE9) is: 在我的计算机上(使用IE9)启动IE的注册表项是:

HKEY_CLASSES_ROOT\\CLSID{0002DF01-0000-0000-C000-000000000046}\\LocalServer32 HKEY_CLASSES_ROOT \\ CLSID {0002DF01-0000-0000-C000-000000000046} \\ LocalServer32

Note that you might need to override the regkey permissions to edit the value. 请注意,您可能需要覆盖regkey权限才能编辑该值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM