禁止“尝试新的跨平台 PowerShell https://aka.ms/pscore6”

Yor*_*ubs 32 console powershell

我不介意微软的营销,但是当我只想要一个干净的 PowerShell 提示时,这很烦人。有没有人找到一种方法可以在删除基本版权信息的情况下只抑制Try the new cross-platform PowerShell https://aka.ms/pscore6打开 PowerShell ?我用谷歌搜索了很多,但没有找到答案(我知道有一种方法可以抑制一切,但我只想摆脱那个 pscore6 广告)。Windows PowerShell, Copyright (C) Microsoft Corporation. All rights reserved.

Eug*_*ich 30

由于Windows Terminal 1.0 已发布,因此您可以改用它。在设置中添加一个标志-NoLogo,如下所示:

    "list": [
  {
    // Make changes here to the powershell.exe profile.
    "guid": "{61c54bd-c2c6-5271-96e7-009a87ff44bf}",
    "name": "Windows PowerShell",
    "commandline": "powershell.exe -NoLogo",
    "hidden": false
  },
Run Code Online (Sandbox Code Playgroud)

  • 这还会删除文本“Windows PowerShell,版权所有 (C) Microsoft Corporation。保留所有权利。” (3认同)

Jer*_*ert 14

此消息是嵌入在资源字符串的一部分Microsoft.PowerShell.ConsoleHostManagedEntranceStrings.resources资源。完整的信息是

版权所有 (C) 微软公司。版权所有。

尝试新的跨平台 PowerShell https://aka.ms/pscore6

这是一个字符串,而不是两个,并且没有选择不同横幅的逻辑。

因为字符串是作为资源读取的,理论上您可以创建一个新的资源程序集并将其放入C:\Windows\System32\WindowsPowerShell\v1.0\en-US. 实际上你不能(即使你愿意将新文件放在系统目录中),因为主程序集是强命名的并安装在 GAC 中,这意味着你不能生成一个附属程序集加载,因为您没有签名所需的私钥。然而,它确实有效——我通过构建这样一个延迟签名的程序集来验证这一点,但显然这在生产系统上并不是一个真正可行的想法。

  • 迷人。谢谢你的杰罗恩。因此,微软决定深度嵌入该广告。耻辱。当 PS 7 全面发布时,他们将进行更新更改以宣传 PS 7。我可以接受吗?当然,但我并不是真正喜欢明目张胆的广告……遗憾的是,没有简单的方法来清除这种毫无意义的微软广告。谢谢! (2认同)

pro*_*365 14

您可以通过在 cmd 中运行此启动 powershell 来摆脱版权横幅:

Powershell.exe -NoLogo -NoExit
Run Code Online (Sandbox Code Playgroud)

-NoExit 正如@Albin 所说,没有必要,您可以从中创建桌面快捷方式/批处理文件。

  • 谢谢你的帖子!将“-NoLogo -NoExit”添加到任务栏上的 PS 快捷方式中,效果就像魔术一样!1. 将 PS 固定到任务栏 2. 右键单击​​图标,右键单击“Windows Powershell”,单击“属性” 3. 在“Target”末尾添加“-NoLogo -NoExit” (2认同)
  • 需要注意的是:“-NoExit”不是必需的,“-NoLogo”也消除了版权信息(OP如何保持版权信息完整) (2认同)

meg*_*o17 7

将 settings.json 中的命令行参数替换为:

\n
"commandline": "powershell.exe -NoLogo -NoExit -Command Write-Host Windows PowerShell`nCopyright `(C`) Microsoft Corporation. All rights reserved.`n",\n
Run Code Online (Sandbox Code Playgroud)\n

电源外壳

\n

它会禁用原始文本,并写入我们需要的内容。\n如果您想编写其他内容,请用于`n换行,并且不要忘记添加`转义保留符号,例如括号。

\n

不同语言示例:

\n
"commandline": "powershell.exe -NoLogo -NoExit -Command Write-Host Windows PowerShell`n`(C`) \xd0\x9a\xd0\xbe\xd1\x80\xd0\xbf\xd0\xbe\xd1\x80\xd0\xb0\xd1\x86\xd0\xb8\xd1\x8f \xd0\x9c\xd0\xb0\xd0\xb9\xd0\xba\xd1\x80\xd0\xbe\xd1\x81\xd0\xbe\xd1\x84\xd1\x82 `(Microsoft Corporation`). \xd0\x92\xd1\x81\xd0\xb5 \xd0\xbf\xd1\x80\xd0\xb0\xd0\xb2\xd0\xb0 \xd0\xb7\xd0\xb0\xd1\x89\xd0\xb8\xd1\x89\xd0\xb5\xd0\xbd\xd1\x8b.`n",\n
Run Code Online (Sandbox Code Playgroud)\n