Sunday 22 April 2018

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


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:\\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:\\chrome.exe" -- "%1" 

I changed to following attempts which did not work:


1. "C:\\chrome.exe" -- "%1" --user-data-dir=D:\Chrome
2. "C:\\chrome.exe" -- "%1" -- "user-data-dir=D:\Chrome"
3. "C:\\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.



Answer



-- 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:\\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.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...