Opening Chrome From Command Line

WindowsGoogle ChromeBatch FileCommand Prompt

Windows Problem Overview


I have the following batch file:

@echo off
REM Starts a chrome browser with multiple tabbed sites
C:\Users\UserName\AppData\Local\Google\Chrome\Application\chrome.exe "site1.com" "site2.com"

But when I run it, it causes the prompt to hang and renders it unusable until Chrome is closed. (Or, if I am not using the prompt and run it from the icon, it opens a blank prompt that is unusable and disappears when Chrome is closed.)

Is there any way to prevent this? I.E. once the webpages are open, the prompt is no longer tied up.

It opens the webpages just fine. I've also noticed that if there's already a chrome window open, the batch runs fine (leaving a usable prompt), adding the tabs to the existing chrome session.

Windows Solutions


Solution 1 - Windows

Have a look into the start command. It should do what you're trying to achieve.

Also, you might be able to leave out path to chrome. The following works on Windows 7:

start chrome "site1.com" "site2.com"

Solution 2 - Windows

Use the start command as follows.

start "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://www.google.com

It will be better to close chrome instances before you open a new one. You can do that as follows:

taskkill /IM chrome.exe
start "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://www.google.com

That'll work for you.

Solution 3 - Windows

C:\>start chrome "http://site1.com" works on Windows Vista.

Solution 4 - Windows

Let's take a look at the start command.

Open Windows command prompt

To open a new Chrome window (blank), type the following:

start chrome --new-window 

or

start chrome

To open a URL in Chrome, type the following:

start chrome --new-window "http://www.iot.qa/2018/02/narrowband-iot.html"

To open a URL in Chrome in incognito mode, type the following:

start chrome --new-window --incognito "http://www.iot.qa/2018/02/narrowband-iot.html"

or

start chrome --incognito "http://www.iot.qa/2018/02/narrowband-iot.html"

Solution 5 - Windows

you can create batch file and insert into it the bellow line:

cmd /k start chrome "http://yourWebSite.com

after that you do just double click on this batch file.

Solution 6 - Windows

open command prompt and type

cd\ (enter)

then type

start chrome "www.google.com"(any website you require)

Solution 7 - Windows

if you want to open incognito window, put the command below:

start chrome /incognito

Solution 8 - Windows

Answering this for Ubuntu users for reference.

Run command google-chrome --app-url "http://localhost/"

Replace your desired URL in the parameter.

You can get more options like incognito mode etc. Run google-chrome --help to see the options.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1473784View Question on Stackoverflow
Solution 1 - WindowsGavinHView Answer on Stackoverflow
Solution 2 - WindowswiseindyView Answer on Stackoverflow
Solution 3 - WindowsguestView Answer on Stackoverflow
Solution 4 - WindowsCBUView Answer on Stackoverflow
Solution 5 - WindowsBERGUIGA Mohamed AmineView Answer on Stackoverflow
Solution 6 - WindowsriyaanmohdView Answer on Stackoverflow
Solution 7 - WindowsShridhar SagariView Answer on Stackoverflow
Solution 8 - WindowsAnurag PrashantView Answer on Stackoverflow