2016-07-25 29 views
1

我想使用隱身/私密模式打開一個包含IE,CH和FF的URL。通過Powershell以隱身/私密模式打開多個瀏覽器

我可以打開使用此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 

我怎麼能打開在隱身模式下的瀏覽器?

回答

2

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對象不支持隱私瀏覽AFAIK

+0

而Internet Explorers選項是「-private」(在url結尾處使用它)。 – TToni

0

這裏新的工作腳本了:

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

謝謝大家的幫助!

+0

如果我的答案解決了您的問題,請考慮通過單擊旁邊的複選標記來接受它:-) –

相關問題