使用PowerShell的IE浏览器保存网页浏览器、网页、PowerShell、IE

由网友(没有你゛左心房都安静ろ)分享简介:我使用Internet Explorer的自动化接口从PowerShell来支持的格式打开一个网页。我要救这个页面回磁盘中通过IE浏览器支持的格式之一。打开网页很简单:I use the automation interface of Internet Explorer from Powershell to open...

我使用Internet Explorer的自动化接口从PowerShell来支持的格式打开一个网页。我要救这个页面回磁盘中通过IE浏览器支持的格式之一。打开网页很简单:

I use the automation interface of Internet Explorer from Powershell to open a web page in a supported format. I want to save this page back to disk in one of the formats supported by IE. Opening the page is easy:

$ie = New-Object -ComObject "InternetExplorer.Application"
$ie.Navigate("C:MyFile.mht")

如何将其重新保存为另一种格式?

How do I save it back in another format?

我需要的,不提示用户,因为这个想法是通过多个文件运行自动运行该脚本中的解决方案。

I need a solution that does not prompt the user since the idea is to automate this in a script running through multiple files.

推荐答案

的你要调用ExecWB用适当的args 的:

$ie.ExecWB(4,0,$null,[ref]$null)

4 PARAMS说明:

Explanation of the 4 params:

4 = OLECMDID_SAVEAS
0 = OLECMDEXECOPT_DODEFAULT (This can also be 2 = OLECMDEXECOPT_DONTPROMPTUSER to not prompt and just save)
$null = NULL (I think this can be a path to save to: separate folders with 2 slashes ())
[ref]$null = ref NULL :)
阅读全文

相关推荐

最新文章