Skip to content

Bug Report: Windows Terminal Ignores startingDirectory in defaults When Launched from Start Menu/Taskbar After System Update | 默认的用户配置启动目录不生效 #19234

@zhu-jl18

Description

@zhu-jl18

Windows Terminal version

1.22.12111.0

Windows build number

10.0.26100.0

Other Software

No response

Steps to reproduce

Bug Report: Windows Terminal Ignores startingDirectory in defaults When Launched from Start Menu/Taskbar After System Update

(plus : I have definitely confirmed that I lauched it from non-Admin mode

1. Summary

After a recent system update, Windows Terminal has started ignoring the startingDirectory setting specified in the profiles.defaults section of settings.json. When launched from a shortcut (e.g., Start Menu, Taskbar), it consistently defaults to C:\WINDOWS\system32. However, the setting is correctly applied if an individual profile has its startingDirectory explicitly set. Launching wt.exe directly from the "Run" dialog (Win+R) works as expected, correctly opening in the user's home directory (C:\Users\Travis).

2. Observed Behavior (The Bug)

  • Global Default is Ignored: The setting "startingDirectory": "%USERPROFILE%" (or any other path) within profiles.defaults has no effect when the terminal is launched from its Start Menu or Taskbar shortcut. The terminal session starts in C:\WINDOWS\system32.
  • Per-Profile Setting Works: If the startingDirectory is set explicitly within a specific profile's JSON object (e.g., the default PowerShell profile), that setting is respected, and the terminal opens in the correct directory. This serves as a temporary workaround.
  • Discrepancy in Launch Method:
    • Fails: Launching from the pinned Taskbar icon or the Start Menu entry results in the incorrect directory (C:\WINDOWS\system32).
    • Succeeds: Launching by typing wt.exe into the "Run" dialog (Win+R) results in the correct directory (C:\Users\Travis).
Image Image

在最近一次系统更新后,出现如下bug(我已确定不是在管理员版本下运行):

  • default里的"startingDirectory": "%USERPROFILE%",设置不生效,从开始菜单打开的 Windows Terminal始终指向Travis C:\WINDOWS\system32;然后当指定具体shell的"startingDirectory": "%USERPROFILE%时候,设置可以生效
  • 经过测试:default"startingDirectory": 无论设置为任何值都不会生效;
  • 如果从win+R 打开wt.exe 则会正常指向 C\users\myname

从win+R wt.exe 可以正常指向
Image

从任务栏打开 不可以正常指向
Image

经过Gemini-2.5的对话: 以下方式均不生效:

  • 显式设置启动目录
  • 配置文件里更改
  • 重新定义快捷方式

希望得到答复。

我的配置文件如下

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "command": 
            {
                "action": "copy",
                "singleLine": false
            },
            "id": "User.copy.644BA8F2"
        },
        {
            "command": "paste",
            "id": "User.paste"
        },
        {
            "command": "find",
            "id": "User.find"
        },
        {
            "command": 
            {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "id": "User.splitPane.A6751878"
        }
    ],
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    "focusFollowMouse": true,
    "initialCols": 80,
    "initialRows": 35,
    "keybindings": 
    [
        {
            "id": "User.copy.644BA8F2",
            "keys": "ctrl+c"
        },
        {
            "id": "User.paste",
            "keys": "ctrl+v"
        },
        {
            "id": "User.find",
            "keys": "ctrl+shift+f"
        },
        {
            "id": "User.splitPane.A6751878",
            "keys": "alt+shift+d"
        }
    ],
    "language": "zh-Hans-CN",
    "newTabMenu": 
    [
        {
            "type": "remainingProfiles"
        }
    ],
    "newTabPosition": "afterCurrentTab",
    "profiles": 
    {
        "defaults": 
        {
            "adjustIndistinguishableColors": "always",
            "backgroundImageOpacity": 0.13,
            "backgroundImageStretchMode": "uniform",
            "bellStyle": 
            [
                "audible",
                "window"
            ],
            "colorScheme": "OneDark",
            "cursorHeight": 24,
            "cursorShape": "underscore",
            "experimental.repositionCursorWithMouse": true,
            "experimental.retroTerminalEffect": false,
            "experimental.rightClickContextMenu": false,
            "font": 
            {
                "cellHeight": "1.4",
                "face": "MesloLGM NF",
                "features": {},
                "size": 12,
                "weight": "light"
            },
            "opacity": 95,
            "padding": "17",
            "scrollbarState": "visible",
            "startingDirectory": "%USERPROFILE%",
            "useAcrylic": false
        },
        "list": 
        [
            {
                "commandline": "pwsh.exe  -nologo\r",
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "icon": "C:\\Program Files\\PowerShell\\7\\assets\\Powershell_avatar.ico",
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore",
                "startingDirectory": null
            },
            {
                "commandline": "powershell.exe -NoLog",
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": true,
                "icon": "C:\\Program Files (x86)\\clink\\clink_cyan.ico",
                "name": "Windows PowerShell",
                "startingDirectory": null
            },
            {
                "commandline": "cmd.exe /k ",
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "icon": "C:\\Program Files\\PowerShell\\7\\assets\\coding.png",
                "name": "Command Line",
                "startingDirectory": null
            },
            {
                "font": 
                {
                    "face": "MesloLGS Nerd Font"
                },
                "guid": "{2ece5bfe-50ed-5f3a-ab87-5cd4baafed2b}",
                "hidden": false,
                "icon": "C:\\Program Files\\PowerShell\\7\\assets\\pull-request.png",
                "name": "Git Bash",
                "source": "Git",
                "startingDirectory": null
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": true,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "commandline": "%WINDIR%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy ByPass -NoExit -Command \"& 'C:\\Roooots\\miniConda\\shell\\condabin\\conda-hook.ps1' ; conda activate 'C:\\Roooots\\miniConda' \"",
                "guid": "{53e7075e-c8d8-58c2-b562-720cfc99636b}",
                "icon": "C:\\Roooots\\miniConda\\Menu\\anaconda_powershell_prompt.ico",
                "name": "Pwsh miniConda",
                "startingDirectory": null
            },
            {
                "commandline": "%WINDIR%\\System32\\cmd.exe \"/K\" C:\\Roooots\\miniConda\\Scripts\\activate.bat C:\\Roooots\\miniConda",
                "guid": "{f93fbb0b-4d22-5237-b3f8-d15af684d8a7}",
                "icon": "C:\\Roooots\\miniConda\\Menu\\anaconda_prompt.ico",
                "name": "Prompt miniConda",
                "startingDirectory": null
            },
            {
                "guid": "{d8e96812-b789-5068-a5ae-10b2fb53e95f}",
                "hidden": false,
                "name": "Ubuntu 24.04.1 LTS",
                "source": "CanonicalGroupLimited.Ubuntu24.04LTS_79rhkp1fndgsc"
            },
            {
                "guid": "{963ff2f7-6aed-5ce3-9d91-90d99571f53a}",
                "hidden": true,
                "name": "Ubuntu-24.04",
                "source": "Windows.Terminal.Wsl"
            }
        ]
    },
    "schemes": 
    [
        {
            "background": "#1E2127",
            "black": "#1E2127",
            "blue": "#61AFEF",
            "brightBlack": "#5C6370",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#D19A66",
            "cursorColor": "#AAAAAA",
            "cyan": "#56B6C2",
            "foreground": "#ABB2BF",
            "green": "#98C379",
            "name": "OneDark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "selectionBackground": "#FFFFFF",
            "white": "#ABB2BF",
            "yellow": "#D19A66"
        }
    ],
    "showTabsInTitlebar": true,
    "snapToGridOnResize": false,
    "tabWidthMode": "equal",
    "theme": "dark",
    "themes": [],
    "useAcrylicInTabRow": true
}

Expected Behavior

When Windows Terminal is launched, it should respect the configuration in settings.json according to its hierarchy. The startingDirectory defined in profiles.defaults should be applied to all profiles but not 'C\winows\system32. The application should start in the user's designated default directory (%USERPROFILE%`) regardless of the launch method (Shortcut, Run dialog, etc.).

Actual Behavior

  • default里的"startingDirectory": "%USERPROFILE%",设置不生效,从开始菜单打开的 Windows Terminal始终指向Travis C:\WINDOWS\system32;然后当指定具体shell的"startingDirectory": "%USERPROFILE%时候,设置可以生效
  • 经过测试:default"startingDirectory": 无论设置为任何值都不会生效;
  • 如果从win+R 打开wt.exe 则会正常指向 C\users\myname

从win+R wt.exe 可以正常指向
Image

从任务栏打开 不可以正常指向
Image

  • Discrepancy in Launch Method:
    • Fails: Launching from the pinned Taskbar icon or the Start Menu entry results in the incorrect directory (C:\WINDOWS\system32).
    • Succeeds: Launching by typing wt.exe into the "Run" dialog (Win+R) results in the correct directory (C:\Users\Travis).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIt either shouldn't be doing this or needs an investigation.Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions