参考链接:https://zhuanlan.zhihu.com/p/109788300

在win10中我按照上述链接中的方法操作,成功移除了终端启动时显示的多余信息。现在电脑更新到win11后又出现了如下所示的广告信息:

安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows

在这里插入图片描述

而按照上述链接中方法操作完成后,settings.json中添加的"terminal.integrated.shellArgs.windows": ["-NoLogo"]这句代码会报警告信息:

This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile in `#terminal.integrated.profiles.windows#` and setting its profile name as the default in `#terminal.integrated.defaultProfile.windows#`. This will currently take priority over the new profiles settings but that will change in the future.

我按照如下方法修改解决了警告:

  1. 打开settings.json(File->Preferences->Settiings打开,往下划随便找到一个Edit in settings.json,点击即可打开settings.json)

  2. 找到"terminal.integrated.defaultProfile.windows": "PowerShell",这条代码

  3. 在这条内容前面加入如下代码:

    "terminal.integrated.profiles.windows": {
        "Command Prompt": {
            "path": "C:\\WINDOWS\\system32\\cmd.exe",
            "icon": "terminal-cmd",
        },
        "PowerShell": {
            "source": "PowerShell",
            "args": ["-NoLogo"],	// 这句话是关键!!!
            "icon": "terminal-powershell"
        },
    },
    

上述代码的关键在于:在"terminal.integrated.profiles.windows"->"PowerShell"中加入"args": ["-NoLogo"]这句话。如果原本settings.json中就有"terminal.integrated.profiles.windows"->"PowerShell"的设置,就只需要在如上所示相应位置加入"args": ["-NoLogo"]这句话就可以了,别的不用动。

  1. 修改后如图所示:
    在这里插入图片描述
    这样就解决了警告,并且在任何情况下都不会再看到那一些多余信息了。
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐