Search code examples
windowspowershellpowershell-corewindows-terminal

How to remove powershell ads and update checks in the Windows Terminal?


When I start the Windows Terminal, I get the following:

enter image description here

How do I get rid of the copyright & version notifications, the help URL and the update check? I just want to get to the command line.

My powershell profile in the settings.json (the config file for the Windows Terminal) is like this:

{
    "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    "hidden": false,
    "name": "PowerShell",
    "source": "Windows.Terminal.PowershellCore",
    "fontFace": "Cascadia Code PL",
    "startingDirectory": "C:\\Users\\user1\\desktop\\"
}

I've seen flags like -nologo and so forth, but I don't have a command line to pass it to.


Solution

  • Update:

    • The answer below shows you to directly edit your settings.json file.

    • As of at least Windows Terminal 1.16, you can alternatively use the GUI:Thanks, Chris

      • Open the Settings tab (e.g. via Ctrl-,)
      • At the bottom of the sidebar on the left, click + Add a new profile, and, next to Duplicate a profile, select your existing PowerShell (Core) profile, then press the Duplicate button.
      • Click on Command line, and modify the existing command line by appending -nologo, as also shown below.

    Create a custom profile in Windows Terminal's settings.json file as follows (inside the profiles.list array property):

    As of at least PowerShell 7.2.1 -nologo also deactivates update notifications:Thanks, Maximilian Hils.

    {
        // no strict need for a GUID; create a *new* one, if needed.
        "hidden": false,
        "name": "PowerShell - no logo, no update notification",
        "commandline": "pwsh.exe -nologo"
        // ... other properties omitted.
    },
    

    In earlier versions you may need environment variable POWERSHELL_UPDATECHECK to disable update notifications:

    {
        // no strict need for a GUID; create a *new* one, if needed.
        "hidden": false,
        "name": "PowerShell - no logo, no update notification",
        "commandline": "cmd /c set POWERSHELL_UPDATECHECK=Off & pwsh.exe -nologo"
        // ... other properties omitted.
    },
    
    • Copy the startingDirectory and fontFace properties from the dynamic profile shown in your question, if desired. (Dynamic profiles are auto-generated by Windows Terminal itself, depending on what shells are found to be installed; they have a source property whose value starts with Windows.Terminal, as in the entry shown in your question.

    • There is no strict need for a guid property in this case (generally, names and GUIDs can be used interchangeably to identify a profile); if you do use one, create a new GUID (e.g. with New-Guid).

      • If you want to use the same name value as that of the dynamic PowerShell Core profile, it's best to hide the latter by setting its hidden property to true.
    • Custom profiles use a commandline property to define what command to execute when a tab with this profile is generated. The value above assumes that PowerShell's executable, pwsh.exe, is in your path; if it isn't and you therefore need to specify a full path, be sure to either double \ chars. (e.g. \"C:\\Program Files\\PowerShell\\7\\pwsh.exe\") or use / instead (e.g. \"C:/Program Files/PowerShell/7/pwsh.exe\")

    • May be required in PowerShell versions before 7.2.1:

      • cmd /c set POWERSHELL_UPDATECHECK=Off defines the relevant environment variable to turn off PowerShell's update notifications, and then launches PowerShell.

        • This means that your PowerShell instances will have a cmd.exe parent process, but that shouldn't be a problem.
      • You can alternatively define this environment variable persistently, via the registry, in which case cmd.exe is no longer needed.

    • Passing -nologo to PowerShell's CLI suppresses the "logo", i.e. the copyright message and help hint.

      • As of at least PowerShell 7.2.1, -nologo automatically deactivates the update notifications as well - potentially, it has always worked this way.