powershell不显示烦人的更新提示,如何隐藏powershell频繁的更新提示

 

PowerShell 7.5.5

 

   A new PowerShell stable release is available: v7.6.0

   Upgrade now, or check out the release page at:

     https://aka.ms/PowerShell-Release?tag=v7.6.0

 

 

最简单直接的是在运行 pwsh.exe 后面添加 -nologo

 

如果是直接通过快捷方式运行powershell:

将powershell快捷方式(C:\ProgramData\Microsoft\Windows\Start Menu\Programs\PowerShell)

的target修改为:

"C:\Program Files\PowerShell\7\pwsh.exe" -nologo -WorkingDirectory ~

 (也就是在后面添加 -nologo, 注意是在双引号的外面添加)

 

 

 如何使用的是Windows Terminal,在设置的powershell profile中,将Command line那一栏修改为

"C:\Program Files\PowerShell\7\pwsh.exe" -nologo

(还是在后面添加 -nologo)

 

来源参考:

https://stackoverflow.com/questions/66958069/how-to-remove-powershell-ads-and-update-checks-in-the-windows-terminal

 

 

下面是gemini给的方法

1. Disable via the powershell.config.json File

PowerShell 7 uses a JSON configuration file that loads before any scripts or environment variables. This is often the most reliable "hard" disable.

  1. Locate your config file: Copy and paste this into your current PowerShell window to open the folder:

    PowerShell
     
    explorer (Split-Path $PSHOME)
    
  2. Edit (or Create) the file: Look for a file named powershell.config.json. If it doesn't exist, create it in that directory.

  3. Add this configuration: Ensure the file contains the following JSON structure:

    JSON
     
    {
      "PowershellUpdateCheck": "Off"
    }
    

    Note: You may need Administrator privileges to save changes in the $PSHOME directory.

2. The "Quiet" Launch Shortcut

If you usually launch PowerShell via a shortcut or the Terminal app, you can add a flag to the execution command to skip the banner entirely.

  • For a Desktop Shortcut: Right-click the shortcut > Properties > Target. Append -nologo to the end.

    • Example: "C:\Program Files\PowerShell\7\pwsh.exe" -nologo

  • For Windows Terminal: 1. Open Settings (Ctrl + ,). 2. Select your PowerShell profile. 3. In the Command line field, add -nologo at the end.

 

posted @ 2026-04-14 17:11  profesor  阅读(121)  评论(0)    收藏  举报