通过 Powershell 以隐身/隐私模式打开多个浏览器

Open multiple browsers in incognito / private mode via Powershell

我想用 incognito/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

这是新的有效脚本:

[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" )

谢谢大家的帮助!

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

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