powershell - 通过 Powershell 以隐身/私有(private)模式打开多个浏览器

标签 powershell multiple-browsers

我想使用隐身/私有(private)模式打开一个带有 IE、CH 和 FF 的 URL。

我可以使用以下 Powershell 脚本使用 3 个浏览器打开 url:

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

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

最佳答案

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 在评论中所指出的,对于 iexplore.exe相当于-private :
[System.Diagnostics.Process]::Start("iexplore.exe","$url -private")
InternetExplorer.Application com 对象不支持 InPrivate 浏览 AFAIK

关于powershell - 通过 Powershell 以隐身/私有(private)模式打开多个浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38565707/

相关文章:

powershell - 无法在递归复制期间排除文件夹

c# - 如何在 docker 容器内运行此 PowerShell 脚本?

excel - 如何在 Powershell 脚本中使用 VBA 代码

html - 如何使我的网站在不同浏览器上看起来相同?

powershell - 当变量值为$ null时,ForEach-Object循环运行

PowerShell mkdir别名+ Set-StrictMode -Version2。奇怪的错误。为什么?

css - 其他浏览器是否实现了条件注释?

jquery - Windows XP 上有多个版本的 Safari?

sql-server - 在 SSRS 报表查看器 Web 控件中显示整个报表?