How to launch Edge with some cmd line args?

1

I'm using Windows 10. According to Microsoft Edge DevTools Protocol docs, I need to launch Edge with the --devtools-server-port cmd line arg.

i tried to do so via Console, but got an error:

'MicrosoftEdge.exe' is not recognized as an internal or external command, operable program or batch file.

After checking out this thread, it turns out that there is apparently some magic with launching Edge by not using standard shortcut in Start menu.

How can we launch Edge with some cmd line args?

Alexander Abakumov

Posted 2018-04-27T17:54:36.297

Reputation: 284

@Clayton: Tried all of those suggestion. While they launch Edge, none seems to be passing --devtools-server-port cmd line arg to it. – Alexander Abakumov – 2018-04-27T20:37:19.190

Are you running an Insider Preview build of windows? From your link The Microsoft Edge DevTools Protocol is currently in preview and works only on Windows Insider Preview builds. – Clayton – 2018-04-27T21:23:22.213

@Clayton: Holy moly, you're right! I'm on the stable version on Win 10. Thank you! – Alexander Abakumov – 2018-04-27T21:48:54.037

@AlexanderAbakumov May I request you to add a formal answer to this thread, if you were able to resolve the problem yourself because of incorrect OS version that you were using. It can be really helpful for future readers who face the same problem. – RBT – 2018-08-25T00:05:48.283

@RBT: Sure, please see my answer below.

– Alexander Abakumov – 2018-08-29T19:38:31.970

Answers

1

As pointed by @Clayton in comments to my question, in order to be able to use Microsoft Edge DevTools Protocol you have to make sure you actually have it in your system first. At the moment, this means that you should update your Windows 10 at least to April 2018 Update (version 1803) or later (see the link in my question for reference).

Then, you can launch Edge with DevTools Protocol server enabled by creating a shortcut on your Desktop with the command like this as a Target:

MicrosoftEdge.exe --devtools-server-port 9220 http://localhost:5000

After launching Edge with this shortcut, you now able to connect to Edge, for instance, with Visual Studio Code just like you used to do so to connect to Chrome. Here is a sample of a corresponding setup from launcn.json:

{
    "type": "edge",
    "request": "attach",
    "name": "Attach to Edge",
    "port": 9220,
    "webRoot": "${workspaceFolder}"
},

Of course for this to work, you need to have the Debugger for Edge extension installed in VS Code.

Alexander Abakumov

Posted 2018-04-27T17:54:36.297

Reputation: 284