start-process "chrome.exe" '--profile-directory="Default"'
When I run this command few times, it opens my default-profile chrome in separate windows. What can I do, to open new tabs, when my default-profile chrome is already opened?
start-process "chrome.exe" '--profile-directory="Default"'
When I run this command few times, it opens my default-profile chrome in separate windows. What can I do, to open new tabs, when my default-profile chrome is already opened?
This will open a Tab instead of a new window for me:
start-process "chrome.exe" "http://localhost:9876/debug.html",'--profile-directory="Default"'
However, if you only want to refresh a page (like you said in the comments), you could also use a little WindowsScript inside of Powershell like this:
# * Get a WindowsScript Shell
$WindowsScriptShell = New-Object -ComObject wscript.shell
# * Check if Chrome is running and activate it
if ($WindowsScriptShell.AppActivate('Chrome')) {
# * Take a nap to give Windows time to focus Chrome
Sleep 2
# * Refresh the page by sending the F5 Key
$WindowsScriptShell.SendKeys('{F5}')
}
# * If Chrome isn't there, tell us
Else {
Write-Output "Chrome is not started!"
}
Does that come close?
With VBScript you could also use the CTRL+<Number>
Combination to switch to a specific tab before refreshing. So you'd have to add
$vbscriptShell.SendKeys('^2')
before the F5 key. I also tried opening a new tab by using CTRL+T
('^T' in VBScript), but that opens a new window and then a new tab for some reason...