【问题标题】:How to remove the powershell banner when running program in VS Code?在 VS Code 中运行程序时如何删除 powershell 横幅?
【发布时间】:2021-09-10 01:45:35
【问题描述】:

当我使用 VS Code 运行 Python 代码时,有什么方法可以删除出现的消息?我只想让程序出现在输出中。

运行程序后,它会给出一个输出:

终端:

Windows PowerShell 版权所有 (C) Microsoft Corporation。版权所有。安装最新的 PowerShell 以获得新功能和改进! https://aka.ms/PSWindows PS C:\Users\domin\Documents\Python - URI> &

【问题讨论】:

标签: powershell visual-studio-code


【解决方案1】:

如果想在PowerShell启动时隐藏版权横幅,可以添加-NoLogo的参数来实现。会是这样的:

  "terminal.integrated.defaultProfile.windows": "PowerShell",
  "terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell",
      "path": [
        "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
      ],
      "args": ["-NoLogo"]   //add this configuration.
    }
  },

【讨论】:

  • 在 settings.json(Ctrl+,).
  • 你选择文件 -> 首选项 -> 设置吗?你能附上它的完整截图吗?
  • 不,它在.vscode 文件夹下。您可以通过Ctrl+,File -> Preferences -> Settings的快捷方式获取。
  • @ymzk_ms 修改“命令行”:“powershell.exe”为“命令行”:“powershell.exe -nologo”,
  • @ymzk_ms 如果有帮助,您能接受这个答案吗?谢谢。
【解决方案2】:

尝试在 VSCode 上使用 Code Runner Extension。它应该在您执行程序时消除这些介绍性消息。

【讨论】:

    猜你喜欢
    • 2021-10-29
    • 1970-01-01
    • 1970-01-01
    • 2018-07-31
    • 2015-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-26
    相关资源
    最近更新 更多