How to launch Microsoft Edge to a specific Workspace?

Paul Jefferies 30 Reputation points
2023-09-11T09:44:11.8766667+00:00

How can I launch Microsoft Edge directly to a specific shared Edge Workspace, ie what is the command line switch?

Preferably I would like to launch two workspaces at once; more preferably I would like to launch them on to the last desktop region that they were arranged on.

I use "{msedgelocation} --restore-last-session" currently but it does not restore Workspaces.

Thank you.

I had a go with "--window-workspace" (from this list of Edge command line switches) using the name of the Workspace and separately with an ID I found (from the share URL). I also tried launching the Workspace share URL in the normal way using Explorer, but that didn't work it just opens a blank browser.

FYI general information about Edge Workspaces.

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,426 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,745 questions
{count} votes

3 answers

Sort by: Most helpful
  1. ITAutom8 40 Reputation points
    2024-02-13T19:44:04.3466667+00:00

    I believe you can use: msedge.exe" --launch-workspace=$workspaceID The ID is located in the workspace cache file: $env:LOCALAPPDATA\Microsoft\Edge\User Data\Profile #\Workspaces\WorkspacesCache

    8 people found this answer helpful.

  2. Raina Zhao - MSFT 2,865 Reputation points Microsoft Vendor
    2023-09-12T06:19:35.75+00:00

    Hi @Paul Jefferies ,

    Currently, it is not supported to directly launch Edge Workspaces using command line. You need to open a workspace from Edge browser.

    This command start msedge --restore-last-session can launch all closed tabs last time.

    We recommend that you could submit a feature request to the Dev Team by sending feedback (Press Alt+Shift+I) in Microsoft Edge.

    Thanks for your understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,

    Raina Zhao

    1 person found this answer helpful.
    0 comments No comments

  3. Brendan Carr 0 Reputation points
    2025-01-16T07:47:52.54+00:00

    I wanted a popup dialog box with a drop down to pick a workspace, so here you guys go!

    You will need to create a shortcut to run this, and it's a bit clunky because it has to hide the console/command prompt. I'm sure it can be improved upon. Here's the shortcut target, and make sure you set it to "run minimized" so you don't see the console/cmd popup.

    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -file "c:\location\folder\script.ps1"

    # Define the path to the JSON file
    $jsonFilePath = "$($env:UserProfile)\AppData\Local\Microsoft\Edge\User Data\Default\Workspaces\WorkspacesCache"
    
    # Read and parse the JSON file
    $jsonContent = Get-Content -Path $jsonFilePath -Raw | ConvertFrom-Json
    # Import the assembly for Windows Forms
    Add-Type -AssemblyName System.Windows.Forms
    
    # Create a new form
    $form = New-Object System.Windows.Forms.Form
    $form.Text = 'Select a Workspace'
    $form.StartPosition = 'CenterScreen'
    $form.AutoSize = $true
    $form.FormBorderStyle = 'FixedDialog'
    $form.MinimizeBox = $false
    $form.MaximizeBox = $false
    $form.Height = 120
    
    # Create a ComboBox for workspace selection
    $comboBox = New-Object System.Windows.Forms.ComboBox
    $comboBox.DropDownStyle = 'DropDownList'
    $comboBox.Width = 250
    $comboBox.Location = New-Object System.Drawing.Point(10, 10)
    
    # Collate workspace names and IDs into the ComboBox
    foreach ($workspace in $jsonContent.workspaces) {
        $comboBox.Items.Add("$($workspace.name) [$($workspace.id)]")
    }
    
    # Add the ComboBox to the form
    $form.Controls.Add($comboBox)
    
    # Create an OK button
    $okButton = New-Object System.Windows.Forms.Button
    $okButton.Text = 'Open Workspace'
    $okButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
    $okButton.Location = New-Object System.Drawing.Point(10, 45)
    $okButton.AutoSize = $true
    
    # Add the OK button to the form
    $form.Controls.Add($okButton)
    
    # Create a Cancel button
    $cancelButton = New-Object System.Windows.Forms.Button
    $cancelButton.Text = 'Cancel'
    $cancelButton.DialogResult = [System.Windows.Forms.DialogResult]::Cancel
    $cancelButton.Location = New-Object System.Drawing.Point(120, 45)
    $cancelButton.AutoSize = $true
    
    # Add the Cancel button to the form
    $form.Controls.Add($cancelButton)
    
    # Show the form and wait for the user to click OK or Cancel
    $result = $form.ShowDialog()
    
    if ($result -eq [System.Windows.Forms.DialogResult]::OK) {
        # Extract the selected workspace name and ID
        $selectedWorkspaceFullText = $comboBox.SelectedItem
        $selectedWorkspaceName = $selectedWorkspaceFullText -replace ' \[\S+\]', ''
        $selectedWorkspaceID = [regex]::Match($selectedWorkspaceFullText, '\[(\S+)\]').groups[1].value
    
        # Shell output of selection
        Write-Output "Selected Workspace Name: $selectedWorkspaceName"
        Write-Output "Selected Workspace ID: $selectedWorkspaceID"
    
        # Launch Microsoft Edge with the selected workspace
        Write-Host "Launching Microsoft Edge for workspace: $selectedWorkspaceName"
        Start-Process -FilePath "msedge.exe" -ArgumentList "--launch-workspace=$selectedWorkspaceID --no-startup-window"
        Write-Host "Workspace has been launched."
    }
    
    
    
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.