How do I start Chrome or Edge in a new isolated window with DevTools open?

Sometimes I want to open Chrome or Edge just to access its JavaScript console for a quick scripting experiment, similar to that in Node/Deno REPL mode.

I don't want to use F12 with a currently open Chrome window/tab to avoid any interfering with its web page's context.

Is there a command line option for that, so I can create a desktop shortcut?


Solution 1:

Answering to my future self. To start Chrome as a new isolated window with DevTools open, from CLI in Windows:

chrome.exe --start-maximized --auto-open-devtools-for-tabs --user-data-dir=%TMP%\chrome -profile-directory=Default about:blank

The same works for Edge, just use a different user-data-dir folder:

msedge.exe --start-maximized --auto-open-devtools-for-tabs --user-data-dir=%TMP%\msedge -profile-directory=Default about:blank

As a one-off, once in DevTools, hit F1 and enable Ctrl+1-9 shortcuts. Then Ctrl+2 is for JavaScript console in Chrome, Ctrl+3 in Edge.