【问题标题】:Open multiple browsers in incognito / private mode via Powershell通过 Powershell 以隐身/私有模式打开多个浏览器
【发布时间】:2020-09-04 08:24:58
【问题描述】:

我想用 IE、CH 和 FF 打开单个 URL,使用隐身/私人模式。

我可以使用这个 Powershell 脚本通过 3 个浏览器打开网址:

Param(
[string] $url
)


[System.Diagnostics.Process]::Start("chrome.exe", $url)      
[System.Diagnostics.Process]::Start("firefox.exe",$url )


$IE=new-object -com internetexplorer.application
$IE.navigate2($url)
$IE.visible=$true

如何在隐身模式下打开浏览器?

【问题讨论】:

    标签: powershell multiple-browsers


    【解决方案1】:

    chrome.exe 采用--incognito 命令行选项:

    [System.Diagnostics.Process]::Start("chrome.exe","--incognito $url")
    

    同样,firefox.exe 采用-private-window 命令行选项:

    [System.Diagnostics.Process]::Start("firefox.exe","-private-window $url")
    

    正如 @TToni 在 cmets 中所指出的,对于 iexplore.exe,等效于 -private

    [System.Diagnostics.Process]::Start("iexplore.exe","$url -private")
    

    InternetExplorer.Application com 对象不支持 InPrivate 浏览 AFAIK

    【讨论】:

    • 并且 Internet Explorer 选项是“-private”(在最后使用它,在 url 之后)。
    【解决方案2】:

    如果您想以与上述相同的方法以“InPrivate”模式启动 Microsoft Edge,则语法如下:

    [System.Diagnostics.Process]::Start("msedge.exe", "-InPrivate https://google.com")
    

    【讨论】:

      【解决方案3】:

      这里是新的工作脚本:

      [System.Diagnostics.Process]::Start("chrome.exe", "--incognito $url")
      [System.Diagnostics.Process]::Start("firefox.exe","-private-window $url" )
      [System.Diagnostics.Process]::Start("iexplore.exe","$url -private" )
      

      谢谢大家的帮助!

      【讨论】:

      • 如果我的回答解决了您的问题,请考虑点击旁边的复选标记接受它:-)
      猜你喜欢
      • 2022-01-05
      • 2019-03-26
      • 1970-01-01
      • 2016-10-11
      • 2017-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-18
      相关资源
      最近更新 更多