David Mason
David Mason

Reputation: 1449

Change directory of profiles that is used for Edge debugging and visual studio code

I just learned that Edge can have different profile directories. The default one is this one and is used most of the time:

C:\Users{userName}\AppData\Local\Microsoft\Edge\User Data

But I could create another set of profiles when I launch the msedge.exe with a user-data-dir parameter. For example like this:

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --user-data-dir=C:\Blub"

If you start edge in this way, you can generate a new set of profiles that are stored in "C:\Blub".

I stumbled across this parameter when I learned how to debug with VS Code.
This article explains that the user-data-dir parameter is also needed for this.
But here you are not using a concrete path, but a value "remote-debug-profile" like this:

edge.exe --remote-debugging-port=9222 --user-data-dir=remote-debug-profile

Also here a new "set of profiles" can be generated that will only be available when launching Edge with the remote-debug-profile parameter.

And the edge debugging only works with profiles stored there. Whenever I try to connect my visual studio code debugger for edge with a profile instance from another directory, this fails.

Is there any way how I can debug profiles that are stored in another directory?

Background is that I sync all my profiles between many devices and those tools prevent me from storing profiles at the default place for debugging.

Upvotes: 0

Views: 981

Answers (1)

Elin Lu
Elin Lu

Reputation: 131

To setting the --remote-debugging-port debug connection, need to set a separate --user-data-dir forces a new instance of the browser to be opened. If this flag isn't given, then the command will open a new window of any running browser and not enter debug mode.

  1. Go to edge://version in Microsoft Edge and view the property Command-line.
  2. If this flag isn't given you need to close all edge processes. Please run the taskkill /f /im msedge.exe in Command-line.
    enter image description here

Note: When setting a separate remote-debug-profile file path, please note that the profile path is enclosed in quotation marks.

Update:
Also, we can manage to get debugging with other profile path.
(For example: I created the path C:/debugging and my cmd is start msedge.exe --remote-debugging-port=9222 --user-data-dir="C:\debugging" --profile-directory="Profile 1") Go to edge://version in Microsoft Edge and view the property Command-line. It shows below screenshot: enter image description here
In the same way, you can specify other paths for debugging.
However, you need to make sure all Edge processes are closed, and check if the separate path is correct.

Upvotes: 0

Related Questions