【问题标题】:How to find which profile.ps1 file is used for the PowerShell Integrated Console?如何查找用于 PowerShell 集成控制台的 profile.ps1 文件?
【发布时间】:2020-05-23 22:55:50
【问题描述】:

在 vscode 中使用 PowerShell 5.1。我的系统上有很多 profile.ps1 文件。

【问题讨论】:

标签: powershell visual-studio-code


【解决方案1】:

要知道您的个人资料应该在哪里,您可以简单地查询$profile 变量:

> $profile

> # It might not exist. Then you can just create it
> if (!(Test-Path $profile)) { 
       Write-Host 'Hello from your new profile' > $profile; 
       "Profile file created in $profile" 
  }

【讨论】:

  • 或者只是New-Item $PROFILE
  • @Carlos Garcia 我相信这对你来说是一个简单的答案,但我花了好几个小时试图确定颜色的来源。部分原因是我有一堆 5.1、7、7.1 的测试安装。并努力进行本地安装。感谢您的帮助卡洛斯!
  • @schuelermine 您的回答效果很好,并且肯定赢得了 Ockhem 的剃刀测试,但毕竟我已经通过尝试确定 Carlos 给出的令人放心的闭环得到答案标记。
猜你喜欢
  • 2011-08-29
  • 2023-01-15
  • 1970-01-01
  • 1970-01-01
  • 2011-07-06
  • 1970-01-01
  • 2018-12-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多