google-chromechrome-remote-debugging

How to make Chrome always launch with remote-debugging-port flag


I know I can launch chrome the following way to open a remote debugging port at 9222 port -

chrome.exe --remote-debugging-port=9222

But I want to setup Chrome such that whenever it is launched by any other application, it always opens with the remote debugging option enabled. Will a custom profile work?

I want to achieve it as there a desktop app that would be launching chrome on clicking its button. I want to control that chrome session.


Solution

  • I have figured out a way to solve my problem statement. I am posting it as an answer as it may help someone else with similar problem statements.

    If you are on Windows, go to registry editor and search this command

    Computer\HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command
    

    Modify the key with the following -

    "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 -- "%1"
    

    If you want to play with Chrome, put --incognito if you always want to launch Chrome in incognito mode.

    Caution: Please backup your registry before playing with it.