Make Chrome always execute with flags, for eg., directly opening an HTML file

4

1

I want to run Chrome with a given set of flags, always

I created a shortcut and added the flag to it in the following way, so my target of the shortcut says:

C:\<application-path>\chrome.exe --user-data-dir=D:\Chrome

But when I double click an HTML file, or if any other application triggers Chrome, it looses the flag value. The result - A new chrome window opens with Default profile directory.

I want to make the flag permanent, so that its active irrespective of however Chrome executes.

I tried changing the following registry key:

HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command

It was this earlier:

"C:\<application-path>\chrome.exe" -- "%1" 

I changed to following attempts which did not work:

1. "C:\<application-path>\chrome.exe" -- "%1" --user-data-dir=D:\Chrome
2. "C:\<application-path>\chrome.exe" -- "%1" -- "user-data-dir=D:\Chrome"
3. "C:\<application-path>\chrome.exe" -- "%1 user-data-dir=D:\Chrome"

Conclusively, when I try to open a link from any application, it doesn't open in my current Chrome as a new tab, rather opens a new Chrome window with no plugins and extensions since its from other directory.

Why I have changed my default directory? - because the OS drive was getting low on memory due to heave Chrome caches and apps.

Om Shankar

Posted 2013-05-26T17:11:41.597

Reputation: 225

Answers

3

-- as a program option means "all arguments that follow aren't program options, but files to open". --user-data-dir=D:\Chrome is an option, but Chrome reads -- first and treats that option as a filename.

Try changing that registry value to the following:

"C:\<application-path>\chrome.exe" --user-data-dir=D:\Chrome -- "%1"

There's also another option. If you don't need the default profile at all and want to replace it with D:\Chrome permanently, then you can replace that profile's directory with a symlink to D:\Chrome. Chrome will still try to load the default profile, but filesystem will redirect it to your custom profile.

gronostaj

Posted 2013-05-26T17:11:41.597

Reputation: 33 047

Forgot to comment that the later part of your answer works like a charm, which is what I initially wanted. Looks like symlinking directories is the only way to save space consumed by Chrome. – Om Shankar – 2014-08-05T06:38:57.260