batch file to open tabs in a NEW browser window
Asked Answered
M

7

17

I need to modify batch file.

I have a batch file that opens many tabs when I click icon from desktop. These tabs are opened in my ALREADY OPENED default browser.

I would like to have a NEW WINDOW open for these tabs.

The batch file looks like this:

@echo off
start "webpage name" "http://someurl.com/"
start "webpage name" "http://someurl.com/"
start "webpage name" "http://someurl.com/"
start "webpage name" "http://someurl.com/"

What changes do I need to make

Mcavoy answered 15/11, 2011 at 21:6 Comment(0)
M
15

I figured this out.

The batch file to open a NEW browser window, and then the intended websites:

@echo off
"C:\Users\THEUSER\AppData\Local\Google\Chrome\Application\chrome.exe"
sleep1
start "webpage name" "http://someurl.com/"
start "webpage name" "http://someurl.com/"
start "webpage name" "http://someurl.com/"
start "webpage name" "http://someurl.com/"

It is working for me. The only caveat, is that if we have a set of pages to open when the new browser window starts up, these will be open too.

Solution? Create another batch file to open those intended websites, and use the desktop file icon to open these. THEN change browser's default configuration to not open specific website or home page on start up.

UPDATE After Alvaro commented on the browser not being the default browser:

For me the default browser is Chrome. Then, for you to set your default browser to open, the line "C:\Users\THEUSER\AppData\Local\Google\Chrome\Application\chrome.exe" should be changed to reflect the path of your intended browser

Mcavoy answered 16/11, 2011 at 17:3 Comment(7)
This solution won't open sites in the default browser, which appeared to be a requisite in the question.Kerouac
@Álvaro G. Vicario For me Chrome is my default browser. Instead of choosing the chrome.exe path, you would choose yourdefaultbroser.exe path.Mcavoy
The solution should be a script to open any url from a batch script in any computer with the default explorer, not with a specific one as how you are posting.Sedberry
Had to change the path to the exe ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"). After making that change, this worked well.Retrorocket
Is there any option to CHECK if the page is already opened in some tab before opening?Fitting
When I open a new window in chrome, I have set it to always open a new empty tab. However with a bat file like this, it's not needed, so is there a way to close it again in bat file?Anemic
This does not work. The default instance of Chrome is used and the tabs are appended. No new window will be opened!Annecy
S
12

This is much simpler:

start chrome.exe yahoo.com 
Stonge answered 11/9, 2013 at 19:12 Comment(2)
Nice, you can send a space separated list. This did the job for me (after starting a new Chrome window first).Treiber
This does not work. The default instance of Chrome is used and the tabs are appended. No new window will be opened!Annecy
G
9

Try this:

@echo off

SET BROWSER=firefox.exe
SET WAIT_TIME=2
START %BROWSER% -new-window "website"
START %BROWSER% -new-window "website"
Gomes answered 21/5, 2015 at 19:39 Comment(0)
H
0
start chrome "google.com"

.exe is not required

Holleran answered 20/5, 2019 at 21:10 Comment(1)
This does not work. The default instance of Chrome is used and the tabs are appended. No new window will be opened!Annecy
A
0

The answer for the year 2024 using the Chrome browser with default profile is:

@echo off
start chrome --new-window "https://www.google.com/" "https://www.google.de/"
Annecy answered 10/4, 2024 at 10:37 Comment(0)
O
0

For future visitors:

@echo off

set "google=https://www.google.com/"
set "stackoverflow=https://stackoverflow.com/"

REM This will be opened in the already opened browser window if there is one
start chrome.exe "%google%"

REM This will be opened in a new window
start chrome.exe -new-window "%stackoverflow%"

REM If you want multiple urls to be opened you can just add them
start chrome.exe -new-window "%stackoverflow%" "%google%"
Openhearted answered 14/5, 2024 at 6:46 Comment(0)
M
-1

if all you have to do is to open multiple tabs at the same time in a single chrome window this is all you need

@echo off
start chrome "Your URL"
start chrome "Your URL"
start chrome "Your URL"
start chrome "Your URL"
Musselman answered 22/7, 2022 at 9:6 Comment(1)
This does not work. The default instance of Chrome is used and the tabs are appended. No new window will be opened!Annecy

© 2022 - 2025 — McMap. All rights reserved.