三局两胜 (@louishino0524)Windows Terminal + PowerShell 7:标签页自动显示当前目录(不改提示符样式) 中发帖

[PixPin_2026-02-14_10-37-07] 
如果你也想让 PowerShell 多标签页自动显示“当前目录名”,可以用下面这个方法。

打开 PowerShell 7 的 profile:

if (!(Test-Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }
notepad $PROFILE

在文件末尾加这段:

if (-not $global:__tab_title_wrapped) {
$global:__original_prompt = (Get-Command prompt -CommandType Function).ScriptBlock
function global:prompt {
$name = Split-Path -Leaf (Get-Lo...