powershell - 蓝底和黑底PowerShell的区别

标签 powershell

我想知道为什么当我从“运行”(或“开始”)和桌面 PowerShell.exe 的快捷方式打开 PowerShell 时,它的背景不同。在第一种情况下,背景是蓝色的,在后一种情况下,背景是黑色的。

PowerShell 的两个窗口之间还有其他区别吗?


编辑 enter image description here enter image description here


编辑 2:在下图中,您可以看到 powershell 进程。此外,如果我直接从 C:\Windows\System32\WindowsPowerShell\v1.0 打开 powershell.exe,背景是蓝色而不是黑色(记住它在桌面上的链接会打开一个黑色背景的 powershell)。

如下图,powershell.exe和Windows PowerShell进程都位于C:\Windows\System32\WindowsPowerShell\v1.0。

P.S.:此处描述的情况在 Windows 10 和 7 上是相同的。

enter image description here


编辑 3 enter image description here enter image description here

如果我进入文件夹 C:\Windows\System32\WindowsPowerShell\v1.0 并右键单击 powershell.exe,则没有颜色选项卡,但它在桌面上的链接有颜色选项卡。

最佳答案

Are there other differences between the two windows of the PowerShell?

可能是,但很可能处于同一水平。 (例如,从您的屏幕截图来看,蓝色控制台更宽,因此可能具有更高的宽度布局设置)。
afaics 看起来它们都是相同的 powershell.exe,但主机设置不同。但只有您可以确认。

如何检查它们是否是相同的“PowerShell”

  • 打开Task Manager > Details选项卡。
    您应该看到 2 个名称为 powershell.exe 的进程.
  • 右键单击> Properties并查看位置
    我怀疑他们都是C:\Windows\System32\WindowsPowerShell\v1.0

为什么一黑一蓝?

  • 右键单击桌面快捷方式> Properties > Colours
    当您使用此快捷方式打开 PowerShell 时,将应用这些设置。
  • 您可以对 Windows PowerShell 执行相同的操作开始菜单中的快捷方式。
    (您可能需要右键单击 > 打开文件位置才能找到实际的快捷方式)
  • 运行 > powershell.exe ,它正在使用注册表中的设置,如 here 所述.

编辑: 所以运行 powershell.exe直接使用存储在路径 HKEY_CURRENT_USER\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe 的注册表中的设置.复制和粘贴快捷方式不会复制这些设置,因为它们未存储在 exe 中。我相信但我不确定快捷方式是否会使用 HKEY_CURRENT_USER\Console\ 中的设置默认。您需要编辑属性以更改快捷方式的设置。您可以在注册表中编辑它们,但这似乎是个坏主意,因为它不仅仅被 PowerShell 使用。


相关内容

  • 您可以更改 Properties 中的默认值以上。
  • Options , FontLayout设置也可能不同。
  • 您可以通过单击左上角的 PowerShell Logo 并转到 powershell.exe 查看当前控制台的值(包括运行 > Properties)
  • 相关链接: $Host , Get-Host 和(如果使用 PSReadLine 模块) Get-PSReadLineOption , Set-PSReadLineOption

关于powershell - 蓝底和黑底PowerShell的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65862733/

相关文章:

c# - CreateProcessWithTokenW winapi 返回 false 但没有原因

asp.net - MS Exchange powershell命令创建了错误的电子邮件ID

c# - 函数中的参数类型验证 - 二进制模块与脚本模块

powershell - 对象与哈希表键比较

powershell - POWERSHELL -lt不起作用

powershell - 如何在 Powershell 中对 3000 万条 csv 记录进行排序

multithreading - Powershell 同时唤醒多个媒体驱动器

windows - 以编程方式禁用快速启动(系统设置)

powershell - 从 PowerShell 调用 CreateProcess

powershell - 相当于 “head -n-3”的PowerShell?