So I'm using PowerShell (specifically version 5.1) in order to write a script for my work that essentially opens some websites depending on what the user selects from available options.
In order to open the website (for this example, let's just say I'm going to Google), I'm using [system.Diagnostics.Process]::Start("chrome","https://www.google.com"). This does open the website, but I'm attempting to open it into a new window entirely. In current state, I can only accomplish this by opening a new window manually and then running the script.
Any suggestions on any switches or anything that might work? I've seen a few on other sites talking about --new-window or -new = 1, but those were for other commands and don't seem to work on this one.
I'm also specifically using Chrome because the sites I am attempting to open require a sign-in, so I already have a Chrome Window open, and it defaults to opening all of my new tabs on the same window, which is what I'm attempting to avoid.
Any help would be greatly appreciated!
The Chrome CLI parameter that requests opening a given URL in a new window is --new-window
It's simpler to use PowerShell's Start-Process cmdlet rather than the underlying .NET API directly.
Therefore:
Start-Process chrome.exe '--new-window https://www.google.com'
See also:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With