1

Is there any way to remove the message that appears when I run Python code with VS Code? I want to leave only the program appearing in the output.

After running the program it gives an output:

Terminal:

Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows PS C:\Users\domin\Documents\Python - URI> &

screenshot of terminal

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
DominickLim4
  • 11
  • 1
  • 4
  • 1
    search for a command line option that of the shell used to not show this message, then try to configure VSC to use this option – rioV8 Sep 10 '21 at 04:29
  • Not specific to removing the powershell banner, but for a clear output when running your Python app, see my answer here: [How to hide file paths when running Python scripts in VS Code?](https://stackoverflow.com/a/61180030/2745495) – Gino Mempin Sep 16 '21 at 11:35

2 Answers2

3

If you want to hides the copyright banner at startup in PowerShell, you can add the parameters fo -NoLogo to achieve it. It will be like this:

  "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.
    }
  },
Steven-MSFT
  • 7,438
  • 1
  • 5
  • 13
  • Where is this configuration file located? – ms_devel Jan 17 '22 at 08:45
  • 1
    In the settings.json(Ctrl+,). – Steven-MSFT Jan 17 '22 at 08:48
  • That's weird, than it just doesn't work. And i have different settings here. https://i.imgur.com/COfJLkX.png – ms_devel Jan 17 '22 at 08:50
  • 1
    Do you choose File -> Preferences -> Settings? And could you attach a full screenshot of it? – Steven-MSFT Jan 17 '22 at 08:58
  • 1
    No, it's under the `.vscode` folder. You can get it through the shortcut of `Ctrl+,` or `File -> Preferences -> Settings`. – Steven-MSFT Jan 17 '22 at 09:19
  • I apologize, it's my fault, I didn't read the assignment correctly. I meant how to get rid of the powershell banner in general, for example in terminal. Not just in vscode. But wherever the powershell terminal is opened. I am not interested only in vscode. but thanks for your time. https://i.imgur.com/z1xUHEG.png – ms_devel Jan 17 '22 at 09:26
  • 1
    @ymzk_ms modify ​"commandline": "powershell.exe" to "commandline": "powershell.exe -nologo", – Steven-MSFT Jan 17 '22 at 09:35
  • 1
    @ymzk_ms If it's helpful could you accept this answer? thanks. – Steven-MSFT Jan 17 '22 at 09:41
1

Try using the Code Runner Extension on VSCode. It should eliminate these introductory messages when you execute your program.