71

When launching Chrome from the Windows command line I can pass arguments like so:

...>chrome.exe -incognito

I can also pass a URL to open:

...>chrome.exe google.com

Each work fine on their own, but I can't get them to work together.

What I want is to launch it with a URL, and open in its own tab, and hide the URL, buttons, etc., like a utility window, but I do want it resizable.

61

You might want to try and give it another try. I just tried it with the following command

chrome.exe google.com -incognito

This gave me the following window, notice that it is in incognito mode (little icon on top left) and it is also at google.com (or whatever url you pass). It works, maybe you were just typing it in wrong.

If you have a window open Chrome will default to the currently running application and add a new tab to that, it saves time (of app startup) and memory. In this case, try

chrome.exe -incognito --app=google.com

alt text

2
  • 1
    Maybe there is something wrong with my installation then. I copied your text and pasted it into my cmd. All it did was add a tab in an already open window (not incognito) and go to google.com. If I remove the google.com part, it opens a new incognito window.... However, if I have no open windows of chrome, it works as desired so I guess the problem is having already open windows. Try it yourself. – JD Isaacks Jun 17 '10 at 14:49
  • 3
    Yes, if you have a window open Chrome will default to the currently running application and add a new tab to that, it saves time (of app startup) and memory. try chrome.exe -incognito --app=google.com – Daisetsu Jun 17 '10 at 17:04
16

I had the same issues trying to open an incognito browser to a specific page. Here's how I got it working:

chrome.exe -incognito --new-window mytargetpage.com
1
  • This solution worked better for me when setting up Chrome as an external browser in Eclipse. – Snekse Jan 26 '11 at 16:30
16

Note: This answer doesn't address wanting to open a URL in incognito mode.


FWIW, here is the Mac version, you can put this in your .bash_profile file:

# Launch Chrome with given URL from command line
alias url='open -a "Google Chrome.app"'

Run the following command for it to take effect:

. ~/.bash_profile

Usage:

url http://www.twitter.com

Note: Yes, you have to put "http://" in front of it. Otherwise, it thinks you're passing in a file.

Here's a shell function that defaults to http: in the absence of a protocol specifier:

url() {
  url=$([[ $1 =~ ^[a-zA-Z]{1,}: ]] && printf '%s\n' "$1" || printf '%s\n' "http://$1")
  open -a 'Google Chrome' "$url"
}
0
8

In Windows command prompt, try the following commands:

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

or

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

If you want to google search rather than a url save this into a batch file called google.bat:

start "google" "c:\program files (x86)\Google\Chrome\Application\chrome.exe" "https://www.google.co.uk/?q=%*#safe=off&q=%*&*"

Then you can call it by typing google search for some text on the command line (or Run window in Windows)

Other switches that are useful are

  • --incognito starts the window as an incognito one
  • --profile-directory="Default" will make the window open as the default chrome user*

Using both of these options gives us this batch file:

start "google" "c:\program files (x86)\Google\Chrome\Application\chrome.exe" --incognito --profile-directory="Default" --new-window "https://www.google.co.uk/?q=%str%#safe=off&q=%str%&*"

*(for other user directories use the directory, e.g. --profile-directory="Profile 2", check the "C:\Users\\AppData\Local\Google\Chrome\User Data" directory (Windows only solution))

2
  • Nice. You can omit the &* btw. – Patrick Hofman Feb 28 '17 at 9:54
  • But is the browser in incognito mode, as the OP wants? – Scott Aug 30 '17 at 4:17
1

If like me you are using Powershell more than cmd.exe these days, you need to invoke things slightly differently.

 & "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-window --incognito https://google.com
1
  • The only one that worked on windows 10. – thisismydesign Dec 15 '20 at 12:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.