How can I open Google Chrome via command-line with a URL, in incognito mode?

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


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

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"
}