新手 (@Novice)【分享】Windows Terminal + PowerShell 7.x 如何保留上次的 tab 和目录 中发帖

Windows Terminal 设置保留上次的 tab,settings.json 根级加: 
{
  "firstWindowPreference": "persistedWindowLayout"
}

或者设置 
 [image] 
查看 PowerShell 的配置文件位置,在 PoweShell 里执行: 
echo $PROFILE

输出: 
C:\Users\xxxx\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

把这段放进 $PROFILE,让终端记住当前目录: 
# 首次使用时创建 PowerShell 配置文件
if (-not (Test-Path $PROFILE)) {
  New-Item -ItemType File -Path $PROFILE -Force | Out-Null
}

# ...
 
 
Back to Top