1

I want to open a single URL with IE, CH and FF, using incognito/private mode.

I can open the url with the 3 browsers using this Powershell script:

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

how can I open the browsers in incognito mode?

Davide Bellone
  • 89
  • 2
  • 10

3 Answers3

6

chrome.exe takes an --incognito command line option:

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

Similarly, firefox.exe takes a -private-window command line option:

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

And as noted by @TToni in the comments, for iexplore.exe the equivalent is -private:

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

The InternetExplorer.Application com object doesn't support InPrivate browsing AFAIK

Mathias R. Jessen
  • 157,619
  • 12
  • 148
  • 206
3

If you wanted to launch Microsoft Edge in "InPrivate" mode in the same method as above, it would be the following syntax:

[System.Diagnostics.Process]::Start("msedge.exe", "-InPrivate https://google.com")
J. Rockwood
  • 118
  • 7
0

Here the new and working script:

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

Thank you all for the help!

Davide Bellone
  • 89
  • 2
  • 10